#include C headers in D code
Atila Neves
atila.neves at gmail.com
Wed Apr 11 10:25:41 UTC 2018
On Wednesday, 11 April 2018 at 06:24:38 UTC, Jacob Carlborg wrote:
> On Monday, 9 April 2018 at 11:03:48 UTC, Atila Neves wrote:
>> Here's my blog post about my project that allows directly
>> #including C headers in D*
>>
>> https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/
>
> How do you deal with macros containing invalid D code, i.e.
> `#define foo(T) sizeof(T)`?
https://github.com/atilaneves/dpp/issues/22
https://github.com/atilaneves/dpp/blob/60f98e4fee2fac0117ac430216ef9c5c25c511fe/tests/issues.d#L229
https://github.com/atilaneves/dpp/blob/60f98e4fee2fac0117ac430216ef9c5c25c511fe/source/dpp/cursor/macro_.d#L55
I did the best I could having seen some macros. It's likely there
are cases I've missed, or that maybe the translation in the link
above doesn't work even for what it's supposed to be doing (I
have no confidence about catching all the C casts for instance).
If there are other cases, I'll fix them as they're encountered.
It's possible some of them can't be fixed and the user will have
to work around them. Right now I have a feeling it will probably
be ok. Time will tell (assuming I have users!).
More information about the Digitalmars-d-announce
mailing list