Re: Haskell calling D code through the FFI

2014-08-06 Thread Jon via Digitalmars-d-learn
./../../x86_64-linux-gnu/libphobos2.so: undefined reference to `_Dmain' On Wednesday, 6 August 2014 at 11:03:33 UTC, David Soria Parra via Digitalmars-d-learn wrote: Jon via Digitalmars-d-learn writes: So that does indeed solve some of the problems. However, using this method,

Re: Haskell calling D code through the FFI

2014-08-05 Thread Jon via Digitalmars-d-learn
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.

Re: Haskell calling D code through the FFI

2014-08-05 Thread Jon via Digitalmars-d-learn
Oh great thank you. I think that might solve the majority of the confusion I was having. One thing I can't figure out though, is getting garbage collection to work as expected. If I have a function that allocates a pointer to a struct using new, I get an error on linking _dAlloc... not found

Re: Haskell calling D code through the FFI

2014-08-04 Thread Jon via Digitalmars-d-learn
As a note, I can interact with strings as expected, but working with structs looks like it will take a little bit of work. On Monday, 4 August 2014 at 22:17:36 UTC, Jon wrote: Yes, thank you. That is exactly what I did. On Monday, 4 August 2014 at 21:48:40 UTC, safety0ff wrote: On Monday, 4

Re: Haskell calling D code through the FFI

2014-08-04 Thread Jon via Digitalmars-d-learn
Yes, thank you. That is exactly what I did. On Monday, 4 August 2014 at 21:48:40 UTC, safety0ff wrote: On Monday, 4 August 2014 at 21:35:21 UTC, Jon wrote: I get Error: core.runtime.rt_init is private. And Error: core.runtime.init is not accessible. I would add them to the header and Hask

Re: Haskell calling D code through the FFI

2014-08-04 Thread Jon via Digitalmars-d-learn
I get Error: core.runtime.rt_init is private. And Error: core.runtime.init is not accessible. On Monday, 4 August 2014 at 21:22:37 UTC, safety0ff wrote: On Monday, 4 August 2014 at 21:14:17 UTC, Jon wrote: On Monday, 4 August 2014 at 21:10:46 UTC, safety0ff wrote: Don't forget to call rt_init

Re: Haskell calling D code through the FFI

2014-08-04 Thread Jon via Digitalmars-d-learn
On Monday, 4 August 2014 at 21:10:46 UTC, safety0ff wrote: Don't forget to call rt_init: http://dlang.org/phobos/core_runtime.html#.rt_init Where/when should I call this?

Haskell calling D code through the FFI

2014-08-04 Thread Jon via Digitalmars-d-learn
TLDR -- Calling D code from Haskell through the FFI works with DMD but not with GDC or LDC2. The time consuming version: Since D allows C to directly call it, if the D code is wrapped in extern (C){ ... }, I thought it should be possible to call such D code from Haskell using the FFI. The F