Haskell runtime in shared library?

Patrick LeBoutillier patl at cpan.org
Tue Jan 27 15:23:05 EST 2009


Hi,

I'm trying to make a shared library containing the Haskell runtime,
but no Haskell code per se.
This shared library would then dynamically load other shared libraries
containing conpiled Haskell code.
Here is some pseudo code:

In my_program:
 dlopen('my_haskell_runtime.so', RT_GLOBAL) ;
 hs_init(...) ;

then later, in my_haskell_runtime.so:
 dlopen('my_haskell_module.so') ;
 __stginit_MyModule();


I've found some great information about FFI stuff here:
 http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#using-own-main
and here:
 http://blog.haskell.cz/pivnik/building-a-shared-library-in-haskell/
but I can't seem to find examples where the runtime is in a different
shared object from the Haskell code/module.

Is this possible to do something like this using GHC?  If so, where
can I find more information of how
exactly to link my_haskell_runtime.so and my_haskell_module.so?

Note: I'm fairy new to FFI (and Haskell in general), so it is possible
that my terminology is lacking.


Thanks a lot,

Patrick

-- 
=====================
Patrick LeBoutillier
Rosemère, Québec, Canada


More information about the Glasgow-haskell-users mailing list