GHCI/FFI/GMP/Me madness

Simon Marlow simonmar at microsoft.com
Tue Aug 10 10:47:13 EDT 2004


On 10 August 2004 14:08, Alastair Reid wrote:

>>   - Rename all the symbols in our GMP to be unique. (sounds hard)
> 
> Nah, easy.
> 
> First get a list of symbols: nm libgmp.a | grep gmp
>   [Supply a few flags to nm to get a better list.]
> 
> Then turn it into a list of #defines:
> 
>   #define gmp_blah ghc_gmp_blah
>   ...
> 
> #include your list of #defines into some header file that everyone
> eats. 
> 
> make clean; make
> 
> 
> You can generate the list by hand or have it rebuilt by make every
> time. 

Hmmm... well maybe.  We'd have to be sure to always use the version of
GMP that comes with GHC - currently we use an installed dynamic version
if one is available.  Statically linking GMP runs into licensing
problems, so I'd have to figure out how to build it dynamically.

The native codegen has to use the revised names, too.  (the #defines
won't work there because it mentions the names inside strings).

I'd bet there are almost certainly some other gotchas.

Cheers,
	SImon


More information about the Glasgow-haskell-users mailing list