[Xcb] Bug#491554: Bug#491554: missing extern "C" stanza for C++ use

Barton C Massey bart at cs.pdx.edu
Wed Jul 30 07:23:20 PDT 2008


Thanks for the bug report!  It should probably be pushed
upstream at some point.  Do you want commit privs to fix it?

	Bart

In message <200807201416.34354.doomster at knuut.de> you wrote:
> Package: libxcb-shape0-dev
> Version: 1.1-1.1
> 
> The header file xcb/shape.h can't be used in C++ directly because it is 
> missing the 
> 
>  #ifdef __cplusplus
>  extern "C" {
>  #endif
> 
>  #ifdef __cplusplus
>  } // extern "C"
>  #endif
> 
> wrappers. This causes linker errors, because to C and C++ the declarations in 
> the headers declare different symbols. Note that this doesn't only affect the 
> shape header, others are affected, too. I used
> 
>  for i in /usr/include/xcb/*; do
>    grep 'extern "C"' $i >/dev/null || echo $i
>  done
> 
> to find header files without the wrapper and it reported a few more from other 
> XCB libraries:
> 
>  /usr/include/xcb/bigreq.h
>  /usr/include/xcb/render.h
>  /usr/include/xcb/shape.h
>  /usr/include/xcb/shm.h
>  /usr/include/xcb/xc_misc.h
>  /usr/include/xcb/xcb_atom.h
>  /usr/include/xcb/xcb_renderutil.h
>  /usr/include/xcb/xcbxlib.h
>  /usr/include/xcb/xproto.h
> 
> Note: xproto.h might be a false positive, because it is included by xcb.h 
> inside its extern "C" wrapper. Further, you can't use it on its own anyway 
> due to its circular dependency on xcb.h. xproto.h defines its include-guard 
> macros and then includes xcb.h, which in turn includes xproto.h a second 
> time. However, the include guards make that a no-op so lateron when using 
> parts of xproto.h it fails. I don't think that file should be included on its 
> own but only by xcb.h, so it should generate a suitable error and the 
> #inlude "xcb.h" should be removed from it.
> 
> 
> Workaround:
> 
>  extern "C" {
>  #include <xcb/shape.h>
>  }
> 
> Uli
> 
> 
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb




More information about the Xcb mailing list