After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 728628 - Fails to link from C++ applications due to excessive symbol mangling
Fails to link from C++ applications due to excessive symbol mangling
Status: RESOLVED FIXED
Product: cogl
Classification: Platform
Component: general
1.18.x
Other All
: Normal normal
: ---
Assigned To: Cogl maintainer(s)
Cogl maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-04-20 22:16 UTC by Emanuele Aina
Modified: 2014-04-22 13:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
framebuffer: Fix linkage from C++ applications (1.10 KB, patch)
2014-04-20 22:16 UTC, Emanuele Aina
none Details | Review
framebuffer: Fix linkage from C++ applications (1.11 KB, patch)
2014-04-22 11:07 UTC, Emanuele Aina
none Details | Review

Description Emanuele Aina 2014-04-20 22:16:44 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.
Comment 1 Emanuele Aina 2014-04-20 22:16:46 UTC
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.
Comment 2 Neil Roberts 2014-04-22 10:54:59 UTC
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.
Comment 3 Emanuele Aina 2014-04-22 11:07:07 UTC
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.
Comment 4 Neil Roberts 2014-04-22 13:44:34 UTC
Cool, thanks. I've pushed it to the 1.18 branch.

https://git.gnome.org/browse/cogl/commit/?id=27dbf700d68a23f9ea3a11e39666b997