[GSoC] Header Generation for C/C++

Manu turkeyman at gmail.com
Wed Jul 17 17:26:58 UTC 2019


On Wed, Jul 17, 2019 at 4:10 AM Eduard Staniloiu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Tuesday, 16 July 2019 at 13:46:56 UTC, rikki cattermole wrote:
> > So currently there is no way to restrict it to just extern(C)?
> > I ask this because -HC makes me think C not C++ headers.
>
> Currently the outputted headers are C++ headers, but we were
> thinking of wrapping `extern (C++)` definitions inside an `#ifdef
> __cplusplus` block, and prefixing any `extern (C)` definitions
> with the following `EXTERNC` macro
>
> ```
> #ifdef __cplusplus
> #define EXTERNC extern(C)
> #else
> #define EXTERNC
> #endif
> ```
>
> This way, the generated header could be used in both C and C++.
>
> What do you think?

Sure, that sort of thing is normal and sensible.


More information about the Digitalmars-d mailing list