#include C headers in D code

Jacob Carlborg doob at me.com
Mon Apr 16 12:26:12 UTC 2018


On Monday, 16 April 2018 at 11:20:51 UTC, Atila Neves wrote:

> You can use the C macros in the headers that you #include in 
> your dpp file.
>
> dstep has a lot of code for translating macros. I don't want to 
> translate macros at all, but it's deeply intertwined with 
> translating everything else.

There's a command line switch to disable that, 
`--translate-macros=false`. Or, alternatively, run the 
preprocessor first.

> I can't remember the specifics, but dstep by default ignores 
> declarations from other headers because the idea is to 
> translate this one particular header.

That's a simple change: replace these lines [1] with `return 
false;`. If that's something you need we can make it configurable.

[1] 
https://github.com/jacob-carlborg/dstep/blob/97870ac5167f09e8acf17f8754c32636492b237f/dstep/translator/Translator.d#L326-L329

--
/Jacob Carlborg



More information about the Digitalmars-d-announce mailing list