Anybody here endure C/Cpp? (.h to .inc conversion)

From: marcus (mrpier_at_juno.com)
Date: 01/01/05


Date: Sat, 01 Jan 2005 00:37:45 -0800


  I'm attempting to convert .h files to .INC as something useable in ASM
syntax. And I'm a bit of a newbiean.

  Can you tell me what this really does?:

typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC)
                (GLenum pname, GLfloat param);

  They mentioned a macro. I'm thinking the macro would be APIENTRY?
but the only thing that looks like it might be a function is:
  GLAPI extern

    Does * mean that PFNGLPOINTPARAMETERFEXTPROC is a pointer?

   Why 2 sets of parenthesis?
  The pname and param are to end up as function params in a call:

   call glPointParameterfEXT, GLenum, GLfloat

  but who's pointer comes from whom? and what gets where how and from
whence? :)
  I dont see how C++ claims easier understanding. Everything's abstracted
 from abstractions. Where's the beef?!
  ANY clue would be greatly appreciated.

  regards,
marcus

  The whole thing is to get extensions for OpenGL using wglGetProcAddress
and the rest of it is like this:

*************** glext.h: ****************
#ifndef GL_EXT_point_parameters
#define GL_EXT_point_parameters 1
#ifdef GL_GLEXT_PROTOTYPES
GLAPI void APIENTRY glPointParameterfEXT (GLenum, GLfloat);
GLAPI void APIENTRY glPointParameterfvEXT (GLenum, const GLfloat *);
#endif /* GL_GLEXT_PROTOTYPES */
typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname,
GLfloat param);
#endif
****************

**************** glext.h
#ifdef _WIN32
typedef void (APIENTRY * PFNGLPOINTPARAMETERFEXTPROC)
                (GLenum pname, GLfloat param);
#endif

<GL/gl.h> header file may already have these typedefs declared if your
<GL/gl.h> defines the
GL_EXT_point_parameters macro. Now declare global variables of the type of
these function
prototype typedefs like this:

#ifdef _WIN32
PFNGLPOINTPARAMETERFEXTPROC glPointParameterfEXT;
#endif

   int hasPointParams = isExtensionSupported("GL_EXT_point_parameters");
#ifdef _WIN32
   if (hasPointParams) {
     glPointParameterfEXT = (PFNGLPOINTPARAMETERFEXTPROC)
       wglGetProcAddress("glPointParameterfEXT");
   }
#endif



Relevant Pages

  • function prototype typedefs Cpp to ASM
    ... I'm attempting to convert .h files to something useful in ASM and dont know much about ASM structures, ... GLAPI void APIENTRY glPointParameterfEXT ... typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) ... typedef void ...
    (comp.lang.asm.x86)
  • Re: Anybody here endure C/Cpp? (.h to .inc conversion)
    ... taking the two arguments GLenum and GLfloat and returning void. ... APIENTRY probably contains the calling convention. ... > Does * mean that PFNGLPOINTPARAMETERFEXTPROC is a pointer? ...
    (alt.lang.asm)