[Pyrex] Function Pointer

Jiba jiba at tuxfamily.org
Sat Mar 6 11:29:30 CET 2004


On Fri, 5 Mar 2004 01:05:01 +0100
Marco Bubke <marco at bubke.de> wrote:

> 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.
> >
> > Try using pure C functions as callbacks, with no Python
> > arguments. That will tell you whether the callback is
> > getting called at all.
> 
> Its not called. If the pointer is NULL there will be no call too.
> Maybe thats the problem. If I look at the C-Code the pointer cast
> looks like (void((*)())). Is this right? I'm not a C guru.

I don't think it is a problem, as long as glu calls you callback
correctly.
You should try to get the callback's adress with "gluGetTessProperty",
in order to ensure there is a callback, and if yes, try to call it
yourself manually.

Jiba




More information about the Pyrex mailing list