Trying to add C++ header generation to dmd

Gregor Mückl gregormueckl at gmx.de
Wed Mar 20 14:26:17 UTC 2019


On Wednesday, 20 March 2019 at 10:27:27 UTC, Jacob Carlborg wrote:
> On 2019-03-19 21:55, Gregor Mückl wrote:
>> [snip]
> I'm not sure if you need to look at the parent. Every 
> declaration has a "linkage" field [1] identifying if it's C++, 
> D or something else. Classes and structs, which don't inherit 
> from Declaration, has a "classKind" field [2].
>
> You can also have a look at this work in progress PR [3].
>
> [1] 
> https://github.com/dlang/dmd/blob/3a298e504707ccd8d633c6ea5511d46c5758fa8b/src/dmd/declaration.d#L289
>
> [2] 
> https://github.com/dlang/dmd/blob/3a298e504707ccd8d633c6ea5511d46c5758fa8b/src/dmd/aggregate.d#L86
>
> [3] https://github.com/dlang/dmd/pull/8591

Do these fields extend properly to children? Consider the 
following code:

extern(C++) class C
{
   int foo(int a, int b);
}

Will foo be marked with C++ linkage? The parameters as well? That 
would simplify the matter a lot.

The pull request does indeed look useful. Thanks!


More information about the Digitalmars-d mailing list