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

Simon Burton simon at arrowtheory.com
Tue Sep 20 09:05:36 CEST 2005


On Mon, 19 Sep 2005 19:45:59 +0200
Fabien Cromières <fabien.cromieres at gmail.com> wrote:

> 
> But, when I want to declare this structure in a pyrex module,  no
> matter what syntax I try, it doesn't work:
> 
> Let us suppose I do:
> ctypedef Container:
>     char c
>     PyObject *(*fonc)(int,int)
> 
> cdef f(int i, int j):
>    return [i,j]

How about this:


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

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

cdef Container cont
cont.fonc = f



Simon.


-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 



More information about the Pyrex mailing list