[MLton] Support for link options in ML Basis files

Matthew Fluet fluet@cs.cornell.edu
Fri, 14 Jan 2005 14:12:16 -0500 (EST)

> Are there any plans to support link options in ML Basis files? For
> example, I have written bindings to some SDL functions neccesary to use
> in place of GLUT with OpenGL.  It would be nice for applications which
> used the SDL and OpenGL bindings to simply add "sdl/sdl-lib.mlb" and
> "gl/gl-lib.mlb" to their .mlb files and have MLton automaticaly use the
> supplied link options when compiling the final executable.

for a similar proposal and
for a reply.

I believe that the reply still applies.

> Also, is
> their a way to have MLton tell you where it keeps SML libraries (for
> example, /usr/lib/mlton/sml/ on my Debian machine) so you could have a
> makefile target install the library in the appropriate place?

I don't think we have a simple way of doing it, but there are a couple of
hacks that would get you that functionality.  If you give mlton a
nonexistent .mlb file, it will print out the path with all MLB path
variables expanded:

-bash-2.05b$ mlton '$(SML_LIB)/z.mlb'
Error: <string> 1.1.
  File /usr/lib/mlton/sml/z.mlb does not exist.
compilation aborted: parseAndElaborate reported errors

Alternatively, compiling a .mlb file with -stop f will yield a list of
files (suitable for a Makefile dependency), again with all path variables

-bash-2.05b$ mlton -stop f '$(SML_LIB)/basis/basis.mlb'

>From either of these, a little grep and sed hackery could should yield the
path you are looking for.