[Pyrex] ctypedef in a "cdef extern from" block

Matthias Baas baas at ira.uka.de
Mon Jun 9 10:17:03 CEST 2003


At 12:20 09.06.2003 +1200, Greg Ewing wrote:
> > The problem with the function pointer is that I can't exactly
> > describe it within Pyrex
>
>Are you sure you can't describe it exactly in Pyrex? What
>does it look like?

I'm trying to write a couple of Python modules that wrap some OpenGL 
extensions under Windows (using Visual C++ 6). To do so I have to obtain 
the function pointers of the extension functions before I can call them. 
Such a function pointer looks like this (taken from wglext.h):

typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int 
iPixelFormat, int iWidth, int iHeight, const int *piAttribList);

The problem is the WINAPI macro which is defined as:

#define WINAPI  __stdcall

Pyrex complains when having a __stdcall in the ctypedef. Everything would 
be fine if Pyrex would just use the type name (PFNWGLCREATEPBUFFERARBPROC) 
when casting a pointer to that type. Then I could just leave the __stdcall 
out, but it would still be in there when the C compiler is doing its work.

- Matthias -





More information about the Pyrex mailing list