Generating C Headers From D Code

Tejas notrealemail at gmail.com
Thu Aug 5 17:04:31 UTC 2021


On Thursday, 5 August 2021 at 17:02:33 UTC, Tejas wrote:
> On Thursday, 5 August 2021 at 16:28:35 UTC, Jack Stouffer wrote:
>> [...]
>
> I also can't find anything... until someone else comes with a 
> better answer, maybe you can do this:
>
> Use the ```-H``` compiler flag to generate ```.di``` files.
>
> Remove all the ```extern(C)``` decls in the .di files.
>
> Rename the file extension from ```.di``` to ```.h```
>
> Technically, it should work. Hopefully someone else knows 
> better.

A small tutorial-ish page for d interface files:
https://wiki.dlang.org/Compiling_and_linking_with_DMD_on_Windows#Writing_and_Using_D_Interface_Files


More information about the Digitalmars-d-learn mailing list