renamed GMP symbols in GHC
fw at deneb.enyo.de
Thu Jan 5 23:02:32 CET 2012
* Simon Marlow:
> One potential problem is that some Linux distributions really don't
> like it if you bundle modified versions of external libraries.
> However, I just don't see a way around this: GMP is inherently broken
> because it has global state, so if you want two use it from two
> clients in the same program, you need two copies of it.
Is this about the allocation functions? You could use the mpn
functions (instead of the mpz variants), where you need to supply your
own memory regions. It's not entirely straightforward because you
need to calculate the expected lengths, manage the sign bit, and
ensure that a few preconditions hold. The only thing which appears to
be really missing is modular exponentiation (mpz_powm and
mpz_powm_ui), but GHC doesn't seem to export them (huh?).
Sure, it's quite a bit of work, but I expect it's more portable than
hairy linker tricks.
More information about the Glasgow-haskell-users