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

Vesa Karvonen vesa.karvonen at cs.helsinki.fi
Thu Nov 23 04:17:29 PST 2006


Has anyone used MLton's MLNLFFI on MinGW?  When I try to compile with
MLNLFFI generated code (-linkage static) I get the following warnings
and errors:

Warning: .drectve `-defaultlib:LIBC ' unrecognized
Warning: .drectve `-defaultlib:OLDNAMES ' unrecognized
C:\DOCUME~1\vesak\LOCALS~1\Temp\file9S7tRi.o:C:\DOCUME~1\vesak\LOCALS~1\Temp\fileypgD91.0.S:(.text+0x2c27): undefined reference
to `dlopen'
C:\DOCUME~1\vesak\LOCALS~1\Temp\file9S7tRi.o:C:\DOCUME~1\vesak\LOCALS~1\Temp\fileypgD91.0.S:(.text+0x2c6f): undefined reference
to `dlerror'
C:\DOCUME~1\vesak\LOCALS~1\Temp\file9S7tRi.o:C:\DOCUME~1\vesak\LOCALS~1\Temp\fileypgD91.0.S:(.text+0x835d): undefined reference
to `dlsym'
C:\DOCUME~1\vesak\LOCALS~1\Temp\file9S7tRi.o:C:\DOCUME~1\vesak\LOCALS~1\Temp\fileypgD91.0.S:(.text+0x83ae): undefined reference
to `dlerror'
collect2: ld returned 1 exit status
call to system failed with signal 1:
gcc -o build C:\DOCUME~1\vesak\LOCALS~1\Temp\fileD6ZuJL.o C:\DOCUME~1\vesak\LOCALS~1\Temp\file9S7tRi.o c-code.o
-Lc:\mingw\lib\mlton\self -lmlton -lgmp -lws2_32 -lkernel32 -lpsapi -lnetapi32 -lgdtoa -lm

Obviously libdl is missing (adding -ldl just complains that the library
can not be found) so the dl* functions do not exist.  Does anyone know
whether libdl is ported to MinGW?  However, what surprises me is that
dl* calls are made even when I specify -linkage static.  I tried just
replacing the dl* imports (in MLNLFFI source) into dummy (exception
raising) functions, but then the executable failed dynamically (with an
exception without exception history even with Exn.keepHistory true).

Next I'm going to try to implement the 4 dl* functions that the MLNLFFI
library requires using the Windows API.

-Vesa Karvonen



More information about the MLton mailing list