GNOME Bugzilla – Bug 728628
Fails to link from C++ applications due to excessive symbol mangling
Last modified: 2014-04-22 13:44:34 UTC
The `extern "C"` guards are missing from cogl-framebuffer-deprecated.h and this causes C++ compilers to mangle its symbols, causing the linking step to fail: undefined reference to `_Z21cogl_push_framebufferPv' undefined reference to `_Z20cogl_pop_framebufferv' undefined reference to `_Z16cogl_read_pixelsiiii19CoglReadPixelsFlags15CoglPixelFormatPh' Adding COGL_BEGIN_DECLS / COGL_END_DECLS guards fixes the issue.
Created attachment 274779 [details] [review] framebuffer: Fix linkage from C++ applications Prevent Cogl function names from being mangled when a C++ compiler is being used by adding some missing COGL_{BEGIN,END}_DECLS guards.
Thanks for the patch. Shouldn't the COGL_BEGIN_DECLS be placed after the #include <cogl-macros.h>? I guess it doesn't really matter in this case, but I think the idea is that you should only put the extern guards after the header's includes because otherwise you can get nested extern declarations.
Created attachment 274877 [details] [review] framebuffer: Fix linkage from C++ applications > Shouldn't the COGL_BEGIN_DECLS be placed after the #include <cogl-macros.h>? I > guess it doesn't really matter in this case, but I think the idea is that you > should only put the extern guards after the header's includes because otherwise > you can get nested extern declarations. Absolutely, my fault. Patch amended.
Cool, thanks. I've pushed it to the 1.18 branch. https://git.gnome.org/browse/cogl/commit/?id=27dbf700d68a23f9ea3a11e39666b997