glxext.h: missing typedef

[email protected] (Joseph Michaud) Mon, 18 Aug 2003 19:54:05 -0400
Newsgroups gmane.comp.video.opengl.sample.general
Message-ID <[email protected]>
1) Is glXGetProcAddress() (and glXGetProcAddressARB()) supposed to be
   defined as specified

     void (*glXGetProcAddressARB(const GLubyte *procName))(...)

   or as listed in the current glxext.h file (dated 2002/03/22)

     typedef void (*__GLXextFuncPtr)(void);
     extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);

   I ask because...


2) The __GLXextFuncPtr typedef is unavailable if glxext.h is
   used in conjunction with GL/gl.h.

   The current glxext.h defines the __GLXextFuncPtr typedef and the
   glXGetProcAddress() prototype:


     #ifndef GLX_ARB_get_proc_address
     typedef void (*__GLXextFuncPtr)(void);
     #endif

     #ifndef GLX_VERSION_1_4
     #define GLX_VERSION_1_4 1
     #ifdef GLX_GLXEXT_PROTOTYPES
     extern __GLXextFuncPtr glXGetProcAddress (const GLubyte *);
     #endif /* GLX_GLXEXT_PROTOTYPES */
     typedef __GLXextFuncPtr ( * PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
     #endif


   Unfortunately, an implementation (such as XFree86-devel-4.2.0-8) which
   defines the glXGetProcAddress() prototype will also define the
   GLX_ARB_get_proc_address macro in GL/gl.h, and the GLXextFuncPtr
   typedef won't get defined, causing a compile error.

   With the latest glxext.h, the following simple source file
   (foo.c) generates an error:
   
     /*
     cc -I. -c foo.c
     
     In file included from foo.c:13:
     glxext.h:362: parse error before `*'
     glxext.h:362: `__GLXextFuncPtr' declared as function returning a function
     */
   
     #include <GL/glx.h>
     #include <glxext.h>
     void foo(void)
     {
         glXGetProcAddress("func");
     }

Joe


-- 
------------------------------------------------------------------------
Joseph Michaud           SGI Applications Eng           [email protected]
vmail: 650-933-9455      office: 781-839-2100