[Pyrex] Function Pointer

Marco Bubke marco at bubke.de
Fri Mar 5 00:57:58 CET 2004


On Friday 05 March 2004 00:41, Greg Ewing wrote:
> Marco Bubke <marco at bubke.de>:
> > cdef void tesselator_vertex(object vertex, object tesselator):
> >   print "vertex: ", vertex._indice
> >
> >   ...
> >
> >     gluTessCallback(self._tesselator, GLU_TESS_VERTEX_DATA,
> > 	<void(*)()>&tesselator_vertex)
>
> Are you sure that the arguments getting passed through to
> your callback are really Python objects (PyObject * in
> C terms)? If not, bad things could happen before the body
> of the callback is reached, even if the arguments aren't
> used anywhere in the body.

Ok, the prototype is tesselator_vertex(void* vertex, void* tesselator)
but I thought that it shloud be possible to pass python objects.

> Try using pure C functions as callbacks, with no Python
> arguments. That will tell you whether the callback is
> getting called at all.
>
Ok, I will try.

thx

Marco




More information about the Pyrex mailing list