[Pyrex] unnamed stucts

Greg Ewing greg.ewing at canterbury.ac.nz
Thu May 8 08:36:46 CEST 2008


Brad Schick wrote:
> Thanks for the feedback, but I'm not sure I see that. Pyrex won't
> compile the code unless I use the names of the nested structs when
> referencing those elements.

Sorry, I must have been thinking of named nested structs when
I wrote that.

What you should do is flatten the struct and declare all the
members of the nested structs and unions directly as members of
the containing struct.

e.g. given your example,

   cdef extern from "header.h":
     unsigned lo
     unsigned hi
     unsigned short lobytes[4]
     unsigned short hibytes[4]
     unsigned char bytes[8]

-- 
Greg



More information about the Pyrex mailing list