[MLton] Some issues with MLton on MinGW
David Hansel
hansel at reactive-systems.com
Fri Mar 2 14:53:46 PST 2007
Hi all,
I am trying to port a large application from SML/NJ to MLton.
The final product needs to be a standalone application on Windows,
which is why we need to use the MinGW (not Cygwin) port of MLton.
Stephen Weeks had been working on porting this for some time and
gotten quite far and I am picking up where he left and trying to
complete the job. All in all this is progressing quite well
although there were some problems along the way which I would like
to share so that they maybe can get fixed.
I was able to work around a number of these issues but am currently
stuck due to the -- let's say -- not-quite-working-yet :) state
of the Socket communication functions (see below). Any help with
this would be greatly appreciated.
- When trying to compile MLton on MinGW, I ran into the following
error:
Error: ..\lib\mlton\basic\vector.sml 10.29.
Variable type in structure disagrees with argument signature.
variable: unfoldi
structure: _ -> [ 'a t ]
signature: _ -> [ 'a t * 'b ]
I was able to work around this issue by Hand-propagating changes
to unfoldi in Vector and Array structures as suggested in
http://mlton.org/pipermail/mlton/2006-May/028744.html
- The program I am trying to compile is rather large. During
compilation (on Linux nad MinGW) I ran into the following errors:
"numPeeks overflow" and "numLinks overflow".
I was able to work around these by commenting out the lines in
lib/mlton/basic/property-list.fun that increase the numPeeks and
numLinks values (a suggestion by Stephen Weeks)
- OS.FileSys.tmpName() returns a unix-style filename (e.g. /tmp/abcde)
which on Windows most likely is not a good temporary filename
(unless the user by chance has a \tmp directory on the current drive)
The return value really should be one in a native Windows temporary
folder
- OS.Process.wait (on MinGW) is off by a factor of 1000, i.e.
OS.Process.wait (Time.fromMilliseconds 10) will wait 10 seconds.
- INetSock.any() and INetSock.toAddr() produce a
"SysErr: Invalid argument [inval]" error when called.
After trying the modifications suggested in
http://mlton.org/pipermail/mlton/2006-December/029466.html
the conversion still does not work. The htons function seems to
not be called correctly (as suggested in
http://mlton.org/cgi-bin/viewsvn.cgi?rev=4333&view=rev )
- After working around the INetSock.toAddr() issue, I found that
neither function Socket.acceptNB() (to check whether a connection
is requested without blocking) nor Socket.select() (to wait until
a connection request arrives or a timeout expires) appear to
be currently implemented. Without either of the two I don't see
any way to accept a connection without blocking the whole
application for an indefinite amount of time. Does anybody know
a workaround for this?
- On the other end, Socket.connect does not appear to work either.
Calling it results in an
"unhandled exception: SysErr: No error [<UNKNOWN>]"
Although this might just be a problem of trying to connect to the
wrong port due to the htons function problem. Although the
server listening on the other end is just a SML program compiled
with the same MLton as the client, so the port number mangling
should be the same in both cases. Note that all of this is on
MinGW under Windows -- it might work fine on Unix/Linux.
Regardless of these problems, we are still hoping to be able to
use MLton for our application at some point and hopefully see
some performance improvements over SML/NJ.
Best regards,
David
--
----------------------------------------------------------
David Hansel
Senior Software Engineer -- Reactive Systems, Inc.
http://www.reactive-systems.com/
hansel at reactive-systems.com
OpenPGP (GnuPG) public key file:
http://www.reactive-systems.com/~hansel/pgp_public_key.txt
----------------------------------------------------------
More information about the MLton
mailing list