This document decribes how to install the Linux to Windows
cross-compiler version of Stephen T. Weeks'
Standard ML compiler MLton. This is based on the old
19990712 release version of MLton. Go to MLton for Windows
for the latest release.
Installing the cross-compiler
First of all you need to install the following:
To download and install the MLton crosscompiler, do the following:
gzip -d MLton_ANOQ20010831.tar.gz tar -xvf MLton_ANOQ20010831.tar
cp -r MLton_ANOQ20010831/ MLton_ANOQ20010831_ToWin32
cd MLton_ANOQ20010831/src make cd ../..If you already have a Linux native version of MLton installed that you want to keep you can remove the directory 'MLton_ANOQ20010831'.
cd MLton_ANOQ20010831_ToWin32/src make cd ../..
cd MLton_ANOQ20010831_ToWin32/src make prepareWin32
make target=win32The makefile will stop with an error when it tries to compile MLton itself - but this is OK since you only need the crosscompiled versions of the runtime libraries.
Your new crosscompiler is now the file 'MLton_ANOQ20010831_ToWin32/bin/mlton'.
Brand new compiler flags for MLton
This brand new MLton crosscompiler some brand new compiler flag that you can set.
To compile ordinary Win32 applications you should problably set the flags something like this:
-D_WIN32 -L/usr/local/cross-tools/lib -L<WhereeverItIsInstalled>/WinMain/srcC/ -lmingw32 -lwinmain -luser32 -lgdi32 -lwinmm -ldxguid
To compile SDL applications you should problably set the flags something like this (besides linking with SDLFuncs.o from SDL::ML):
-D_WIN32 -DUSE_SDL -L/usr/local/cross-tools/lib -lmingw32 -lSDLmain -lSDL -luser32 -lgdi32 -lwinmm -ldxguid -mwindowsNow you might want to check out how to use my SDL bindings for ML - SDL::ML.
To use MLTon's cmcat tool (for concatenating an SML/NJ/CM project into one single sourcefile suitable for compilation with MLton) you will also need SML/NJ working version 110.9.1 or later. Notice that this may conflict if you're also using MLKit for typechecking your code, since MLKit does NOT compile with SML/NJ version 110.9.1, where as SML/NJ version 110.0.3 and SML/NJ version 110.0.7 works fine for MLKit. And to run either MLKit or cmcat you need an SML/NJ runtime of a compatible version, so you may soon find yourself continuously swapping between 2 versions of SML/NJ.
However if you change line 153 of the cmcat source code from '[file] => ((cmcat{sources = mkAbsolute{path =file, relativeTo = getDir()}' to '[file] => ((cmcat{sources = mkAbsolute (file, getDir())'
It should compile with SML/NJ version 110.0.7 so that
you can use the same runtime for both MLKit and cmcat.
Patch desscription
Follow the link below for a description of how I have patched the '1999-7-12' release of MLton into the 20010831 cross-compiler distribution.
Modified: 2023-05-19
E-mail: Contact