Re: problems compiling new PECL module

From: Date: Mon, 10 Jan 2011 19:10:48 +0000
Subject: Re: problems compiling new PECL module
References: 1 2 3 4 5 6  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-7933@lists.php.net to get a copy of this message
> I'm not sure if I understood correctly what you're trying to do, but > if you want to return an instance of noise::module::Module to userland > as a PHP object, you would need to declare its class (Noise_Module) > and assign a proper constructor/destructor handler just like you did > with your other classes. In C++, what I want to do is: ---------- noise::module::Const n_const; n_const.SetConstValue(-1.0); noise::module::Abs n_abs; n_abs.SetSourceModule(0, n_const); noise::module::Module n_module* = NULL; n_module = n_abs.GetSourceModule(0); /* this should return a pointer to n_const */ ---------- The PHP translation would look something like this: ---------- $n_const = new Noise_Const(); $n_const->SetConstValue(-1.0); $n_abs = new Noise_Abs(); $n_abs->SetSourceModule(0, $n_const); /* this is now working properly */ $n_module = $n_abs->GetSourceModule(0); /* $n_module should now be a reference to $n_const; this currently core dumps */ ---------- So, the return value for GetSourceModule is an instance of a noise::module::Module (the abstract class for the other two classes) that has already been instantiated in my PHP code and assigned via SetSourceModule. Does that make sense? -- Tim Gustafson tjg@tgustafson.com 831-332-1496 http://tgustafson.com/

« previous php.pecl.dev (#7933) next »