Haskell calling D code through the FFI
safety0ff via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Aug 5 18:12:59 PDT 2014
On Tuesday, 5 August 2014 at 23:23:43 UTC, Jon wrote:
> So that does indeed solve some of the problems. However, using
> this method, when linking I get two errors, undefined reference
> rt_init() and rt_term() I had just put these methods in the
> header file. If I put wrappers around these functions and
> export I get the rt_init, rt_term is private.
>
It works for me, here are the main parts of my Makefile:
DC = ~/bin/dmd
main: Main.hs FunctionsInD.a
ghc -o main Main.hs FunctionsInD.a ~/lib/libphobos2.a -lpthread
FunctionsInD.a: FunctionsInD.d
$(DC) -c -lib FunctionsInD.d
I passed in the phobos object directly because I don't know how
to specify the "~/lib" directory on the ghc command line.
More information about the Digitalmars-d-learn
mailing list