[MLton] Shared libraries for MLton

Matthew Fluet fluet@cs.cornell.edu
Mon, 25 Jul 2005 13:08:25 -0400 (EDT)


> Matthew Fluet wrote:
> >>  - mlton/main/main.fun
> >>     o Added new compiler option -shared-library
> >>  - mlton/control/control-flags.sig/sml
> >>     o added Control.sharedLibrary, which defaults to false
> > 
> > Fair enough, though I don't see that they are used at all within the 
> > compiler proper.
> 
> Is Primitive a better place?

Yes and no. ;-) The Basis Library implementation is separate from the
compiler implementation.  You'll want both a Primitive.MLton.sharedLibrary
binding in the Basis Library (using _build_const) as well as a
Control.sharedLibrary in the compiler implementation.  The 
Control.sharedLibrary will be affected by the command line flag and also 
used in mlton/main/lookup-constant.fun to ensure that when the appropriate 
_build_const is encountered in the Basis Library implementation it is 
replaced by the boolean appropriate to this compile.

>From what you've said, there is nothing else in the compilation process 
that needs to be treated differently when producing a shared library, so 
it makes sense that Control.sharedLibrary won't be used elsewhere.