Ease of calling C code from D

Atila Neves atila.neves at gmail.com
Tue Jan 28 14:33:25 PST 2014


On Tuesday, 28 January 2014 at 22:16:59 UTC, Dicebot wrote:
> On Tuesday, 28 January 2014 at 22:11:29 UTC, Atila Neves wrote:
>>> Did you see Jacob's dstep too?
>>
>> I think I read about it here in the forum at some point and 
>> somehow forgot about it. I'll definitely give it a go.
>
> There is a dstep package in Arch Linux [community] ;)

Well, then I just _had_ to try it immediately ;). Nice output on
some toy stuff I had, but as the github README.md says itself, no
preprocessor magic and as far as I can tell no way to specify -I
flags so it finds the other headers that get included from the
original header.

Nice tool, but nowhere near as easy as including the header from
C++.

I know it's even harder to call C code from other languages
(*cough* JNI *cough*), but it's still not automagical from D. It
is in C++ (well, assuming the header in question has the
appropriate #ifdef'ed extern "C", and even if not it can be done
before the #include). I wish I could use D for my use case, but I
couldn't responsibly recommend it. Oh well. One of these days
I'll figure out how to write D for a living :)

Atila


More information about the Digitalmars-d mailing list