On Mon, May 12, 2008 at 6:29 AM, 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? >
Nothing? This code compiles and runs fine in Cython-0.9.6.13 (see
attached screenshot). Note that I deleted plugDefinition since you
didn't define that above.
ctypedef struct plugData:
char *ident
void *data
def foo():
cdef plugData *data = <plugData*>malloc(sizeof(plugData))
data.ident = "foo"
-- William
<<attachment: Picture 2.png>>
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
