[MLton-user] mlton-20070826 on mingw

Wesley W. Terpstra wesley at terpstra.ca
Tue Dec 11 11:17:59 PST 2007


On Dec 10, 2007, at 6:29 PM, Bernard Berthomieu wrote:
> We could successfully compile our applications, and they run  
> correctly with libgmp
> dynamically linked. However, for compiling, we had to remove the  
> declarations of
> timezone and gettimeofday from file <mltondir>/lib/mlton/include/ 
> platform/mingw.h
> as  these are now provided by the current mingw headers and gcc  
> complained for
> the redeclarations.

There is a patch pending which resolves this. However, by just  
removing the declaration you will have link errors, because  
gettimeofday is not consistently defined in a library MLton links (or  
wants to link) to. The approach I took is to #define gettimeofday to  
something else in the mingw.h.

> Now, to ease installation of our applications,  I typically install  
> mlton so that libgmp
> is statically linked with the applications, by putting a copy of  
> libgmp.a into
> lib/mlton/self. I have seen in previous messages on this list that  
> this does not work
> for mlton-20070826 on mingw. If I'm doing this, I get the link error:
>
>     <mltondir>\lib\mlton\self/libmlton.a(gc.o):gc.c:(.text+0x2ec5):  
> undefined reference to `_imp____gmpz_cmp'
>     <mltondir>\lib\mlton\self/libmlton.a(gc.o):gc.c:(.text+0x4289):  
> undefined reference to `_imp____gmpz_get_str'
>     <mltondir> etc,

I recently rebuilt a native mingw/w32 MLton, also using statically  
linked gmp, and I didn't see this problem.

Are you aware that the gmp.h only works for either a static or dynamic  
GMP, but not both (on windows)? If your prebuilt gmp had a gmp.h for  
dynamic use, you cannot link programs compiled against it with a  
static gmp. Try rebuilding gmp from source.




More information about the MLton-user mailing list