[Haskell-cafe] Writing C libraries in Haskell

Richard G. richardg at richardg.name
Sat May 1 05:34:19 EDT 2010


Hello

I have a few questions about using Haskell (GHC, in particular) to write 
self-contained libraries with a C interface.

----

If libraries foo and bar are compiled using the same version of GHC, is 
is possible to link the two libraries into the same executable?  Does 
anything special need to be done?

----

If library foo was compiled using GHC 6.10.4 and library bar was 
compiled using 6.12.1, is it possible to link the two libraries into the 
same executable?

----

I'm using the following code to initialize the GHC runtime:

     hs_init(&argc, &argv);
     hs_add_root(__stginit_CabalProjectzm0zi0zi2zi0_SimpleModule);

where SimpleModule is a module that exports functions via FFI.

Is it safe to add more modules after I call a function exported by this 
module?

----

Also, once hs_exit() has been called, is it possible to reinitialize the 
GHC runtime?

Thanks,

Richard


More information about the Haskell-Cafe mailing list