built in import c header files

Atila Neves atila.neves at gmail.com
Wed Oct 7 10:04:57 UTC 2020


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.

It really isn't. Can it be easy? Yes. Is it easy in the general 
case? No.

I've tried calling a large C codebase from D before. It was a 
nightmare. It's very hard to do manual wrapping when you have 
thousands of headers in hundreds of directories and everything 
depends on everything.


More information about the Digitalmars-d mailing list