Bug 13542

Summary: GLX header doesn't protect all functions
Product: Mesa Reporter: Joseph Garvin <k04jg02>
Component: GLXAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86 (IA32)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Joseph Garvin 2007-12-05 18:21:59 UTC
As another user reported here: http://www.nabble.com/--mesa3d-Bugs-1844243---GLX-header-definition-t4944614.html

In the header glx.h, all functions declarations are not encapsulated into the consistent definitions (e.g. "#ifndef GLX_VERSION_1_x"). All defines are set at the beginning of the header file ("#define GLX_VERSION_1_1 1", etc) 

In a mixed environment where a project uses GLEW but depends on a library that includes glx.h, they will get this error:

/usr/include/GL/glx.h:202: error: declaration of C function 'void glXCopyContext(Display*, __GLXcontextRec*, __GLXcontextRec*, long unsigned int)' conflicts with
/usr/include/GL/glxew.h:118: error: previous declaration 'void glXCopyContext(Display*, __GLXcontextRec*, __GLXcontextRec*, GLuint)' here

The reason being that the types don't agree for the last parameter. I've filed a bug with GLEW to fix this on their end:

http://sourceforge.net/tracker/index.php?func=detail&aid=1845264&group_id=67586&atid=523274

But I think it also makes sense to encapsulate the functions in glx.h, thus this report.
Comment 1 Kristian Høgsberg 2010-05-07 13:56:44 UTC
We only use the #ifndef mechanism for extension, not for core entry points.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.