[MLton] MLNLFFI doesn't link on MinGW(?)

Vesa Karvonen vesa.karvonen at cs.helsinki.fi
Fri Nov 24 03:44:54 PST 2006


Quoting Matthew Fluet <fluet at cs.cornell.edu>:
[...]
> > I finally got an exception history and saw that the dl* calls are made
> > from CMemAlloc (memalloc-a4-unix.sml), which uses them to get access to
> > malloc and free.  The source file also contained replacements that used
> > MLton's FFI to (statically) import malloc and free.  Is there some reason
> > why malloc and free must/should be obtained through dl* functions?
> 
> I simply followed the SML/NJ implementation as closely as I could.  That 
> implemenation uses the dl* functions to grab malloc/free, but I probably 
> tried out the static versions for exactly the situation you are 
> considering: using -linkage static to avoid dl* entirely.

I would guess that the reason why the SML/NJ implementation uses the dl*
functions to obtain malloc and free is that it is the only way (in SML/NJ).
If that is the case, then I think that it would be better if MLton would
just use the MLton FFI (static linking) to import malloc and free (on all
platforms).

-Vesa Karvonen



More information about the MLton mailing list