[MLton] Re: MLton and shared libraries

Matthew Fluet fluet@cs.cornell.edu
Tue, 26 Apr 2005 16:15:11 -0400 (EDT)


> I am happy to report, that the first MLton generated shared library
> now works with MzScheme.

Great.

> There are two things to note:
> 
>    1. It is important that both gcc and ld gets the -symbolic and -Bsymbolic
>       options respectively
> 
>    2. The MLton option -link-opt doesn't pass the option directly to ld
>       but to gcc, which means that linker options is to be prefixed with
>       an explicit -Wl, .
> 
> I must admit that it took me a long time to figure 2 out (bear with me,
> it is at least five years since I wrote my last C program).

It should be quite easy to make "-shared true" a mlton option and take 
care of items 1) and 2) in the compiler itself, as well as adjusting the 
suffix of the output file.

The "-link-opt" mlton option is a little confusing, in that it is options
to be passed to gcc when it is called to link .o files.

> I'll keep you posted on my further progress.

Please do.  We'll be more than happy to integrate the changes into a 
future MLton release.