On 2008-05-05, Paul Lowman <
paul_lowman@...> wrote:
> That helped - it now compiles but unless I remove the %newobject line in
> example.i no code appears in example.php for the factory method. Even
> then - either way - I get -
>
> Fatal error: Call to a member function area() on a non-object in
> /usr/src/swig-1.3.35/Examples/php4/shadow/runme.php4 on line 13
>
> This is the problem I cannot resolve - how do I get php to see the
> returned resource as an instance of a class?
It needs to be wrapped in the appropriate PHP class (using
"new MyPHPClass($handle)" IIRC), which should happen automatically
in the PHP wrapper for CircleFactory().
> This apparently worked OK in php4 so what are the relevent changes?
I guess you mean changes between PHP4 and PHP5 support?
The two work in completely different ways. PHP4 constructs PHP objects
using the C API. The functions used aren't present in PHP5 (hence the
zend_property_reference() errors you saw), and the PHP APIs aren't
well documented so we couldn't see how to fix this. So instead we
took the approach used in SWIG/Python and wrap the C++ class as a
set of flat functions which take a resource as the first argument, then
create a PHP class wrapper which has the resource as a member variable
and methods which call the flat functions.
If you're able to see what needs fixing (in Source/Modules/php4.cxx
I imagine) a patch would be great. Otherwise, file a bug and I'll take
a look when I get a chance.
Cheers,
Olly
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user