[MLton] linking with GnuMP

Wesley W. Terpstra terpstra@gkec.tu-darmstadt.de
Thu, 23 Dec 2004 05:46:45 +0100

On Wed, Dec 22, 2004 at 05:38:08PM -0800, Stephen Weeks wrote:
> This happens because of the special code to link with libgmp.a.  If I
> force the link to happen with -lgmp, then I get just gmpn_set_str.  I
> don't understand why the satic link causes everything to be brought
> in, but whatever.

That's because gmpn_set_str depends on those other methods which depend on
yet others. Dynamic linking only lists the actual unresolved symbols.

Crucially, mpn_set_str uses mul and add, which pull in of course Karatsuba
and FFT multiplication and thus the whole works. =)

> I've argued before that we should link statically when compiling
> MLton, to make it easier for people to install.

On linux, libgmp is a very standard component. It makes little sense to omit
it there. For MacOS or windows I would am more understanding.

Wesley W. Terpstra