[MLton-user] Re: MLton and Cygwin installation

Wesley W. Terpstra wesley@terpstra.ca
Wed, 7 Dec 2005 20:42:45 +0100

On Dec 7, 2005, at 7:04 PM, Brian Donovan wrote:
> I was able to compile the helloworld.ml file to a 364KB file with no
> extension named simply helloworld.  This seems to be expected (that
> it's extensionless), but helloworld won't run from either the bash or
> the Windows prompt.  Manually editing the filename to end in .exe lets
> me run it and get the expected "Hello, world!".

 From bash, you need to add a './' before the filename, so

This is because bash (unlike cmd) doesn't path the current directory.

> Is there some separate step after the compile to get me to an exe?  Is
> manually adding ".exe" to the filename what other Windows MLton users
> do?  Would the MinGW package produce extensionless files as well?

The binary you get from a cygwin compile depends on cygwin. This is
partly what causes the large size, and also why there is no '.exe'. Just
renaming it to .exe and trying to run it will not always work from  
the way you expect, because it needs the cygwin1.dll. If you use it from
bash, it will always work, because cygwin bash makes sure the dll can
be found by applications it runs.

There is no way to convert a cygwin binary to a normal windows binary.

If you use the MinGW package, you will get windows native executables.
These will have a '.exe' on the end, and will not depend on cygwin. That
means you can give them to your friends, without needing them to also
install cygwin to get the cygwin1.dll.

I haven't used the newest MLton for  MinGW yet, but I believe it has a
mlton.bat instead of a bash shell script. That means, you should be able
to run mlton from the windows command prompt, instead of needing bash.

Hope that makes sense!

It sounds to me like you have a windows background; in that case, i
would recommend the MinGW package. The cygwin package feels
more natural to us crufty *nix users, but it probably seems a bit odd to
someone with windows experience. OTOH, the MinGW package is
newer, and probably the installation is not documented as well. :-(