[Pyrex] Function Pointer

Marco Bubke marco at bubke.de
Sat Mar 6 20:01:54 CET 2004


On Saturday 06 March 2004 11:29, Jiba wrote:
> 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.

That must be a hack. There is nothing in Spec that says that this is possible.





More information about the Pyrex mailing list