Converting void * to PyObject * in Pyrex
Ganesan R
rganesan at myrealbox.com
Fri Mar 14 00:02:52 EST 2003
>>>>> "Ganesan" == Ganesan R <rganesan at myrealbox.com> writes:
> cdef SLPBoolean MySLPSrvTypeCallback(SLPHandle slph, char *srvtype,
> SLPError errcode, void *cookie):
> srvtypelist = <PyObject *>cookie
> if errcode == SLP_OK:
> srvtypelist.append(srvtype)
> elif errcode == SLP_LAST_CALL:
> pass
> else:
> raise SLPException(errcode)
> return SLP_TRUE
> -------
> cookie is really a python list cast to void *. Pyrex complains:
> /home/rganesan/sf/openslp/pyrex/slp.pyx:40:28: Declarator should be empty
> /home/rganesan/sf/openslp/pyrex/slp.pyx:40:28: Expected '>'
> How do I fix this?
Never mind. I figured it out myself. I needed to do
srvtypelist = <object>cookie
Ganesan
--
Ganesan R
More information about the Python-list
mailing list