bug report: 20100608 mingw fails to link imported function

Bernard Berthomieu <[email protected]>
Newsgroups gmane.comp.lang.ml.mlton.devel
Message-ID <[email protected]>
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

[email protected]
http://www.laas.fr/~bernard
phone  +33/(0)5 61 33 63 63
fax    +33/(0)5 61 33 64 11
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.