[Pyrex] Problem with the declaration of variable/struct containing references to functions

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Sep 20 05:30:03 CEST 2005


Fabien Cromières wrote:

> Let us suppose I do:
> ctypedef Container:
>     char c
>     PyObject *(*fonc)(int,int)

You want 'object', not 'PyObject *':

   ctypedef struct Container:
     char c
     object (*fonc)(int,int)

   cdef object f(int i, int j):
     return [i,j]

   cdef Container cont
   cont.fonc = f

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list