[Haskell-cafe] Compiling a haskell project as a shared library and loading it in C/C++
A.M.
agentm at themactionfaction.com
Mon Sep 3 03:01:11 CEST 2012
On 09/01/2012 12:13 AM, Farid Neshat wrote:
> 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
You need to link against the haskell runtime:
ghc --make -dynamic -shared -fPIC -no-hs-main -o X.so
-optl-Wl,-rpath,/usr/lib/ghc/ -lHSrts_debug-ghc7.4.1
Cheers,
M
More information about the Haskell-Cafe
mailing list