On May 12, 2008, at 10:33 AM, Johannes Wienke wrote:

Am 05/12/2008 04:12 PM schrieb Lisandro Dalcin:
Do you also have a 'cdef class plugData' defined somewhere ?

No, do I need that?

No, you don't.


On 5/12/08, Johannes Wienke <[EMAIL PROTECTED]> wrote:
Hi again,

maybe I'm blind or I don't know but how do I assign a value to a struct
 member?

 This code:
 cdef plugData *data = <plugData*>malloc(sizeof(plugData))
 data.ident = "foo"

 with this definition of plugData:
 ctypedef struct plugData:
        plugDefinition *plug
        char *ident
        void *data

 generates an error:
 "Object of type 'plugData' has no attribute 'ident'"

 What's wrong with this?

I just tried

ctypedef struct plugData:
#       plugDefinition *plug
        char *ident
        void *data

cdef plugData *data = <plugData*>malloc(sizeof(plugData))
data.ident = "foo"

and it works fine for me. Perhaps you're redefining plugData somewhere else in your header files?

- Robert


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to