[MLton-user] Problem CallingFromCToSML

Matthew Fluet fluet at tti-c.org
Fri Jun 19 07:43:10 PDT 2009


On Fri, 19 Jun 2009, Rodrigo Saad wrote:
> I am trying to reproduce the example provided at the page
> http://mlton.org/CallingFromCToSML without lucky.
> I am getting the following error:
> %% mlton -default-ann 'allowFFI true' export.sml ffi-export.o
> /tmp/fileCdFGgC.o: In function `L_7':
> (.text +0x1f80): undefined reference to `MLton_FFI_Int8'
> collect2: ld returned 1 exit status
> call to system failed with exit status 1:
> gcc -o export /tmp/fileK4YlnF.o /tmp/fileCdFGgC.o ffi-export.o
> -L/usr/lib/mlton/self -lmlton -lgdtoa -lm -lgmp
>
> I have been looking over the web for this error and i haven't found
> anything useful.
> Any help is appreciated.

In mlton-20070826, there was a bug in the implementation of _export-ed 
functions using the char type, leading to the linker error:
   http://mlton.org/Bugs20070826
   http://mlton.org/pipermail/mlton-user/2007-August/001174.html
   http://mlton.org/pipermail/mlton-user/2007-September/001175.html

You can apply the patch described in the last link (to 
/usr/lib/mlton/sml/basis/ffi.sml or 
/usr/local/lib/mlton/sml/basis/ffi.sml, depending on your platform).



More information about the MLton-user mailing list