Page 1 of 1

fucntion return a struct pointer

PostPosted: Fri Apr 23, 2010 11:50 am
by linjichao
i try get a struct pointer from build-in function, the build-in function is define by me in ge project, when i call the function i get a error from ge editor,
it says: "read error in invalid memory area", follow is my code for example:


struct st
{
char* name;
struct st* next
};

static val_t eic_getSt(void)
{
val_t v;
v.ival = 0;
struct st* mySt = NULL;
mySt = dbf_getSt();
if(ret == DONE)
{
v.p.p = v.p.sp = mySt ;
setEp(v.p, sizeof(struct st));
}
return v;
}

Re: fucntion return a struct pointer

PostPosted: Sat Apr 24, 2010 3:52 pm
by makslane
Try look whats happen in the checkPtr or checkPtrSimple functions.
May be, your function are returning a NULL value.