built in import c header files

norm normical at gmail.com
Wed Oct 7 11:14:02 UTC 2020


On Wednesday, 7 October 2020 at 10:04:57 UTC, Atila Neves wrote:
> On Wednesday, 7 October 2020 at 01:29:05 UTC, norm wrote:
>> On Tuesday, 6 October 2020 at 22:42:11 UTC, 12345swordy wrote:
>>> On Tuesday, 6 October 2020 at 21:04:20 UTC, Meta wrote:
>>>> On Tuesday, 6 October 2020 at 20:59:54 UTC, 12345swordy 
>>>> wrote:
>>>>> I remember reading a reddit comment saying that if d were 
>>>>> to import c header files directly without any 3rd party 
>>>>> libraries it would be a game changer. The question is: how 
>>>>> difficult to implement a C AST parser for the dmd front end?
>>>>>
>>>>>
>>>>> -Alex
>>>>
>>>> You're in luck: https://github.com/atilaneves/dpp
>>>
>>> What part of "built in and not part of a 3rd party library" 
>>> do you not understand?
>>
>> You could easily work it out for yourself by looking at any C 
>> parser and the DMD front.
>
>> But why bother with C, it is trivial to generate C bindings 
>> from headers.
>

Really? I have not had any issues before automatically creating C 
bindings for D using codegen. Sure, occasionally a macro will 
bite but it isn't that often nor difficult to fix.  They were not 
the kernel but they were not small code bases without macros 
either.

TBH though now I just use dpp so I don't see the value of bolting 
on a "C" parser to the D front end. C++ I have struggled with 
that and it requires an annoying amount of manual editing. DPP 
works well but even it falls over for some C++ code bases I've 
tried.





More information about the Digitalmars-d mailing list