[Pyrex] access to c data class members

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Aug 28 01:37:13 UTC 2006


ahalda at cs.mcgill.ca wrote:

> cdef class MyClass:
> 	cdef OBJSTRUCT *data      #pointer to a struct
> 
> def load_File():
> 	newObj = MyClass()               #alternately, 'cdef Module newMod'
> 	newObj.data = c_mod.getData() #returns pointer to the new object
> 	return newObj

You need to declare the type of newObj:

   def load_File():
     cdef MyClass newObj
     newObj = MyClass()
     ...

--
Greg



More information about the Pyrex mailing list