#include C headers in D code

Petar Petar
Sat Apr 14 04:07:12 UTC 2018


On Friday, 13 April 2018 at 10:31:43 UTC, Atila Neves wrote:
> On Wednesday, 11 April 2018 at 14:33:26 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*
>>
>> I don't know the exact details of your project but can't you 
>> just:
>>
>> 1. Copy the includes
>> 2. Paste them into a C file
>> 3. Run DStep on the C file
>> 4. Replace the includes in the first file with the result from 
>> DStep
>>
>> This would require changing DStep to always return `false` 
>> here [1]. Or perhaps run the preprocessor to expand the 
>> includes and then run DStep.
>>
>> [1] 
>> https://github.com/jacob-carlborg/dstep/blob/master/dstep/translator/Translator.d#L326
>>
>> --
>> /Jacob Carlborg
>
> That wouldn't have the same semantics as I want.
>
> I tried using dstep as a library. It didn't work.

You also mentioned this in the reddit thread, though I'm still 
curious to understand what's difference in the semantics between 
the approach you have taken and the approach Jacob proposed.


More information about the Digitalmars-d-announce mailing list