[Haskell-cafe] Compiling a haskell project as a shared library and loading it in C/C++
35 views
Skip to first unread message
Farid Neshat
unread,
Sep 1, 2012, 12:13:46 AM9/1/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haskel...@haskell.org
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:
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:
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haskel...@haskell.org
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