On Sat, 31 Dec 2005 10:05:06 +0000 (UTC) "Marcus Agehall (PacketFront) @ Pike (-) developers forum" 10353@lyskom.lysator.liu.se wrote:
I'm working on Xine-bindings for pike and I've encountered a situation where I need to access variables in other objects, declared as CVAR in the cmod source.
My program structure looks like this
PIKECLASS Engine { PIKECLASS AudioPort program_flags PROGRAM_USES_PARENT; { CVAR int my_variable; }
PIKECLASS Stream program_flags PROGRAM_USES_PARENT; { PIKEFUN void create(object /*AudioPort object*/ ap) { /* Here I need to access ap->my_variable */ } } }
I've looked a bit at how I resolve the parent context in the inner classes, but I can't make it work for the ap-object.
I guess my question boils down to, how do I find out where the AudioPort local variables begin in ap->storage?
You can use OBJ2_AudioPort(ap)->my_variable. If you want to see an example of a class which takes an object of another class in its constructor, take a look at Public.Parser.ClearSilver on modules.gotpike.org.
Adam