So I'm trying to follow [this blog][1]. So I tried the code, couldn't
compile the haskell part, probably due to the fact the guide uses
version 6, but I have version 7 of ghc. By changing the paramaters I
could compile it with the following:

ghc --make -dynamic -shared -fPIC -no-hs-main -optl '-shared' -optc
'-DMODULE=Test' -o Test.so Test.hs module_init.c

But the when trying to load it, on dlopen, I get the following error:

/usr/lib/ghc/ghc-prim-0.2.0.0/libHSghc-prim-0.2.0.0-ghc7.4.1.so:
undefined symbol: stg_forkOnzh

I suspect it's because the haskell runtime is not linked to the shared
library but adding -L/usr/lib/ghc/ didn't really help. I searched a
lot, but couldn't find anymore example that somebody have done this.
[Here's also some docs][2] for compiling shared libraries:

[1]: http://weblog.haskell.cz/pivnik/building-a-shared-library-in-haskell
[2]: 
http://www.haskell.org/ghc/docs/7.4.1/html/users_guide/using-shared-libs.html

_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to