[Xcb] no extern "C" in the generated header files

Peter Harris git at peter.is-a-geek.org
Sun Mar 8 08:42:56 PDT 2009

On Sun, Mar 8, 2009 at 11:10 AM, Vincent Torri wrote:
> On Sun, 8 Mar 2009, Peter Harris wrote:
>> On Sun, Mar 8, 2009 at 10:58 AM, Vincent Torri wrote:
>>> There is no extern "C" in the generated header files. This breaks linking
>>> with a c++ compiler. Is it a bug in the python parser ?
>> No. It is a bug in the C++ program that tries to include a C header
>> outside of extern "C".
> in all the C header files i know, there's always a
> #ifdef __cplusplus
> extern "C" {
> #endif
> around the declaration functions and variables that are exported.

That would make it a C/C++ hybrid header, not a C header.

I just picked two C projects at random (Lua and Git), and neither one
has an extern "C" in any .h file. Clearly, your experience does not
match mine.

However, to pick a C project very much *not* at random, Xlib (the
library that xcb is striving to replace) does appear to use extern "C"
via Xfuncproto, which surprised me. In light of this, I imagine a
patch to xcb to add extern "C" where appropriate would be welcomed.

Peter Harris

More information about the Xcb mailing list