[MLton] cvs commit: Loading dynamic libraries works on Darwin

Stephen Weeks MLton@mlton.org
Tue, 28 Sep 2004 16:25:31 -0700


> > It's been on Solaris since the first port over two years ago.  I
> > suspect it's there because linking failed otherwise.
> 
> I don't see why.  ldl only seems to provide the dl* functions, which
> shouldn't be necessary for normal MLton compiles.

I agree it doesn't make sense.  So, I ran a few tests and they all
worked without -ldl.  We'll see what happens when I run the next full
set of regressions on Sparc, which I don't do very often since my
Sparc is so slow.

> Well, proper use of any linker option requires -target-link-opt, if
> you want to account for what may or may not be in the standard lib
> on different machines.

True.  My point is that for stuff we distribute, we have been hiding
the necessity of -target-link-opt from the user by putting the
necessary switches in bin/mlton-script.  By shipping iimport.sml, we
need to do one of the following:

1. add the appropriate -target-link-opt's to bin/mlton-script
2. expose -target-link-opt in ffi/Makefile
3. compute the os use Makefile hackery and add appropriate -link-opt's

Each of these has its benefits and drawbacks.  We have been using (1)
for stuff we ship, although lib/opengl currently uses (3).  You added
a -link-opt flag initially for iimport.sml, but that only worked on
Linux and Solaris, so I went to (1).  However, after this discussion,
I think -target-link-opt works well, and is better than Makefile
hackery.  So, the right thing is (2), to fix lib/opengl to also use
-target-link-opt, and to document -target-link-opt.