[GSoC] Header Generation for C/C++

Eduard Staniloiu edi33416 at gmail.com
Wed Jul 17 11:05:21 UTC 2019


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?


More information about the Digitalmars-d mailing list