[MLton] Possible bug in MLton-7230.msi for MinGW and 64 bit questions

David Hansel hansel at reactive-systems.com
Sat Oct 31 18:43:08 PST 2009


Hi all,

We recently tried compiling our code with the MLton-7230 MinGW experimental
release from your web site.  Our code had been working fine when compiled
using the "MLton MLTONVERSION (built Tue Feb 03 16:33:30 2009 on orange)"
build.  It compiled fine with the 7230 release but the generated executable
always crashed immediately after starting.  We found that the crashes only
occurred when using the FFI interface and that they always happened during calls to "dlopen".
(line 142 in MLton\lib\mlton\sml\mlnlffi-lib\memory\linkage-dlopen.sml)
After some more digging we found a change between the two versions regarding the
RTLD_* constants used in file
MLton\lib\mlton\sml\mlnlffi-lib\memory\linkage-libdl.sml
For the older version,  the constants defined in that file were
   val RTLD_LAZY   = 0wx00001
   val RTLD_NOW    = 0wx00002
   val RTLD_GLOBAL = 0wx00100
   val RTLD_LOCAL  = 0wx00000
whereas with the 7230 version,  the constants from
MLton\lib\mlton\sml\mlnlffi-lib\memory\platform\rtld-flags.mingw.sml
are used which are defined as
   val RTLD_GLOBAL = 0wx2
   val RTLD_LAZY   = 0wx0
   val RTLD_LOCAL  = 0wx4
   val RTLD_NOW    = 0wx0

After changing the constants in rtld-flags.mingw.sml to the values from the previous
version,  the crashes went away.  Our code calls DynLinkage.open_lib with
parameters "global=true" and "lazy=true",  so the values of the constants
definitely come into play.  Should we be using different parameters or is this
a bug in MLton?

Also,  from the web site it sounds like the MLton-7230.msi version supports
generating Windows 64 bit executables,  is that true?  If so,  how do we tell
MLton to generate a 64 bit executable?  If not,  can you tell us what the
current state of Windows 64 bit support for MLton is?

Thank you very much and best regards,

David

-- 
  ----------------------------------------------------------
  David Hansel
  http://www.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