[MLton] bug report: 20100608 mingw fails to link imported function

Bernard Berthomieu bernard at laas.fr
Tue Sep 21 02:28:03 PDT 2010


Hello,

File sz.sml contains:

    fun main () =
        let val intsize = _import "IntSize" : unit -> int;
        in print (Int.toString (intsize ())); print "\n"
        end;
    main ();

File sz.c contains:

    long IntSize () {return (sizeof(int));}

A link error occurs with 20100608-mingw when compiling as follows:

mlton -default-ann 'allowFFI true' sz.sml sz.c
C:\Users\bernard\AppData\Local\Temp\fileaVhuWq.o:fake:(.text+0x38fc): 
undefined reference to `_imp__IntSize'
collect2: ld returned 1 exit status
call to system failed with exit status 1:
gcc -o sz C:\Users\bernard\AppData\Local\Temp\file1C8kNN.o 
C:\Users\bernard\AppData\Local\Temp\fileaVhuWq.o 
C:\Users\bernard\AppData\Local\Temp\file6y5t43.o -Lc:\program 
files\mlton\lib\mlton\targets\self -lmlton -lgdtoa -lm -lgmp -lws2_32 
-lkernel32 -lpsapi -lnetapi32 -lwinmm -Wl,--enable-stdcall-fixup -m32


The same command succeeds with 20100608 on linux, macosx or solaris.


  Bernard.

--

Bernard Berthomieu
LAAS / CNRS
7, avenue du Colonel Roche
31077 Toulouse Cedex
France

Bernard.Berthomieu at laas.fr
http://www.laas.fr/~bernard
phone  +33/(0)5 61 33 63 63
fax    +33/(0)5 61 33 64 11





More information about the MLton mailing list