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

Fabien Cromières fabien.cromieres at gmail.com
Tue Sep 20 16:35:22 CEST 2005


Yes, that was it.
Thank you all.

2005/9/20, Greg Ewing <greg.ewing at canterbury.ac.nz>:
> 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