Re: How to deal with C_POINTR?
- Posted by stabmaster_ at hotmail.com Mar 31, 2003
- 443 views
I guess you could receive a structure using some assembly code, though i don't know how structs are returned by value. Can't exactly put in a register, so the stack would be probable.. Anyway, I can't see in what situation anyone would like to pass/return structs by value. If it's a dll written by someone else and you have the source code, then by all means fix it to do it the proper way (i.e. using pointers). > > >when define and call c_func often there are parameters passed by > > >pointers, then how to send and get data if it is a c struct? > > > > Let's say you have: > > > > typedef struct > > { > > int a,b; > > } foo; > > > > foo *bar(foo *grill) > > { > > return grill; > > } > >The problem though is when you have something like ... > > foo bar(foo grill) >{ > return grill; >} > >In other words, the struct is passed by value, not as a pointer to struct. > >In this case, it is difficult. Sometimes, if the stuct ONLY has 32-bit >values in it, you can fake passing it as a set of C_UINT values, but >returning a struct is impossible, I suspect. >