[Pyrex] access to c data class members
Lenard Lindstrom
len-l at telus.net
Sun Aug 27 19:37:59 UTC 2006
On 27 Aug 2006 at 13:30, 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
> ------------------------------------
>
> If I create a python object by 'newObj = MyClass()', when I modify the data
> by newObj.data, i get : "Cannot convert 'OBJSTRUCT (*)' to Python object"
> on the second line of the fuction.
>
Try declaring newObj as cdef MyClass.
Lenard Lindstrom
<len-l at telus.net>
More information about the Pyrex
mailing list