C binding with D function

llaine via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Aug 3 08:08:51 PDT 2016


On Wednesday, 3 August 2016 at 14:58:04 UTC, bachmeier wrote:
> On Wednesday, 3 August 2016 at 14:01:34 UTC, llaine wrote:
>> On Wednesday, 3 August 2016 at 13:49:36 UTC, bachmeier wrote:
>>
>>> Probably because you need the D runtime. One way is to import 
>>> core.runtime and call Runtime.initialize().
>>
>>
>> Where should I call this Runtime.initialize() ?
>
> Does the second answer to this question
>
> http://stackoverflow.com/questions/676498/haskell-binding-with-ruby-through-ffi
>
> help? It's Haskell, but I think the hs_init function call is 
> equivalent to Runtime.initialize. I've never done this sort of 
> thing with Ruby so I might be missing something.


So basically I have to create wrapper.c ?
I guess my D code is not valid.

For example, if I call it directly from a C program it would also 
breaks for sure.

Is there any good documentation on it? I've look at the official 
documentation, but i'm afraid it might be too advanced for me.



More information about the Digitalmars-d-learn mailing list