Haskell calling D code through the FFI

Jon via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Aug 5 16:23:42 PDT 2014


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.

On Tuesday, 5 August 2014 at 21:28:08 UTC, David Soria Parra 
wrote:
> On Monday, 4 August 2014 at 20:48:09 UTC, Jon wrote:
>
>> For reasons I don't completely understand, you also need a 
>> fake main function, dummy.d:
>>
>>    void main(){}
>>
>
> Note that this is not necessary if you compile with -lib e.g.:
>
>   dmd -lib -oflibtest.a test.d
>
> and then
>
>   ghc Main.hs --make -omain libtest.a
>
> I don't have gdc or ldc installed but as far as I know ldc has 
> a -lib flag as well.



More information about the Digitalmars-d-learn mailing list