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

Stephen Weeks MLton@mlton.org
Tue, 28 Sep 2004 13:07:24 -0700


> It doesn't require any compiler support (other than ensuring that the
> appropriate dynamic linking library is linked in -- which reminds me, why
> is -ldl in the link-opt for so many platforms?), so I argue against it.
> Also, note that it is a quick and dirty implementation.  For example, it
> doesn't play well with MLton.World.{load,save}, because the addresses
> returned by dlsym aren't valid across different executions.

Fair enough.  Although we should certainly provide a library at some
point after the release.

I see -ldl on two platforms, Linux and Solaris.  It's on Linux because
I recently added it, specifically for the DynLink stuff.  Given the
above, it makes sense to move it back to doc/examples/ffi/Makefile.
It's been on Solaris since the first port over two years ago.  I
suspect it's there because linking failed otherwise.

I do want to point out that proper use of -ldl requires
-target-link-opt (which is undocumented) rather than -link-opt (which
is documented).  I know we're trying to keep the option count down,
but exposing -ldl pushes towards exposing and documenting
-target-{cc,link}-opt.