Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gl prototypes aren't surrounded by extern "C" and so fail to link to c++ code #106

Closed
pyrolitic opened this issue Mar 3, 2017 · 2 comments
Labels

Comments

@pyrolitic
Copy link

Since commit 0625a74 where the EPOXY_BEGIN/END_DECLS were introduced, include/gl.h contains the lines

#include "epoxy/gl_generated.h"

EPOXY_BEGIN_DECLS

EPOXY_PUBLIC bool epoxy_has_gl_extension(const char *extension);
EPOXY_PUBLIC bool epoxy_is_desktop_gl(void);
EPOXY_PUBLIC int epoxy_gl_version(void);

EPOXY_END_DECLS

This causes the epoxy specific prototypes to be surrounded by extern "C", but not the OpenGL prototypes from include/gl_generated.h. Is this by design? It causes my C++ code to fail to link (windows, msvc 2015).

My fix was to swap the first two lines quoted above.

@ebassi
Copy link
Collaborator

ebassi commented Mar 3, 2017

Mmh, it was definitely not intended, but I'm also not entirely sure the original behaviour was intended either. :-)

@ebassi
Copy link
Collaborator

ebassi commented Mar 3, 2017

A workaround would be to add the C++ guards around #include <epoxy/gl.h> and friends.

ebassi added a commit to ebassi/libepoxy that referenced this issue Mar 3, 2017
Commit 0625a74 moved the C++ guards
after the inclusion of the generated headers, which was an unintended
behavioural change and now requires header guards around the inclusion
of Epoxy headers.

Fixes: anholt#106
@ebassi ebassi added the bug label Mar 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants