fucntion return a struct pointer

Questions, comments and discussion about the Game Editor development.

fucntion return a struct pointer

Postby linjichao » Fri Apr 23, 2010 11:50 am

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;
}
linjichao
 
Posts: 35
Joined: Fri Jan 22, 2010 10:13 am
Score: 0 Give a positive score

Re: fucntion return a struct pointer

Postby makslane » Sat Apr 24, 2010 3:52 pm

Try look whats happen in the checkPtr or checkPtrSimple functions.
May be, your function are returning a NULL value.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest