On Thursday, 5 August 2021 at 16:28:35 UTC, Jack Stouffer wrote:
I need to generate plain C99 .h files from a D module's
extern(C) declarations, so that I can link a DMD generated .o
file with a C code base. Are there any automated tools which do
this?
I know the compiler has C++ header generation, and there's tons
of tools which exist for importing C headers into D code. I'm
not aware of anything which goes the other direction. Google
wasn't much help either.
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.