Make DMD emit C++ .h files same as .di files

Manu turkeyman at gmail.com
Mon Feb 25 01:04:50 UTC 2019


On Sun, Feb 24, 2019 at 4:05 PM Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 2/24/19 6:24 PM, Manu wrote:
> > I've been talking about this for years, and logged this a while back:
> > https://issues.dlang.org/show_bug.cgi?id=19579
> >
> > Is there anyone interested in or knows how to do this?
> > It would really be super valuable; this idea would motivate
> > inter-language projects that typically go C++-fist-with-a-D-binding to
> > work the other way.
> >
> > Creating a pressure to write D-code first because the binding part is
> > maintained automatically when you compile is potentially significant;
> > gets programmers thinking and writing D code as first-class.
> >
> > Idea would be same as emitting .di files, but in this case only
> > extern(C)/extern(C++) declarations would be emit to a .h file.
> >
> > I could use this to create some nice demos in my office which I think
> > would get a few people talking and excited.
>
> Yes that would be fantastic, and something I'd advocated for a long time
> as well. It would be in fact a prime application of the relatively
> recent ability to use dmd as a library. No need to modify the compiler,
> just walk the AST and output the header. Should be a couple hundred
> lines for good effect.

Why wouldn't you do it in the same pass as the .di output?


More information about the Digitalmars-d mailing list