Re: [cython-users] How to #define a token to make #include #ifdefs work?

32 views
Skip to first unread message

Robert Bradshaw

unread,
Oct 22, 2012, 9:16:23 PM10/22/12
to cython...@googlegroups.com
On Mon, Oct 22, 2012 at 3:41 PM, Richard Jones <r1char...@gmail.com> wrote:
> I'm including GL/glext.h (through .pxd declarations) but all of the function
> prototypes are hidden behind "#ifdef GL_GLEXT_PROTOTYPES". How do I define
> that in my cython code so I get those prototypes?
>
> The pxd currently looks like this:
>
> cdef extern from "GL/glext.h":
> void glUniform1f(GLint location, GLfloat v0)
> void glUniform2f(GLint location, GLfloat v0, GLfloat v1)
> void glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
>
> But when it comes to compile time the prototypes aren't defined and I'm
> getting typing problems because of it.

See http://docs.python.org/distutils/setupscript.html#preprocessor-options

- Robert

Richard Jones

unread,
Oct 22, 2012, 10:15:40 PM10/22/12
to cython...@googlegroups.com
I ended up with a different approach. Replace "GL/glext.h" with
"mygl.h" in the above and then mygl.h has:

#define GL_GLEXT_PROTOTYPES
#include "GL/gl.h"
#include "GL/glext.h"

I'm not entirely sure which solution I prefer.


Richard
Reply all
Reply to author
Forward
0 new messages