From: Olly B. <ol...@su...> - 2007-12-11 22:40:05
|
On 2007-12-11, Vadim Zeitlin <vz...@ze...> wrote: > Maybe I'm making some stupid mistake in my PHP code? No, the PHP code looks fine to me. I can make this work by adding this ctor to ptr.i: shared_ptr(const shared_ptr &); The C++ compiler should implicitly create such a copy constructor in this situation, so I don't know why SWIG isn't doing so, but at least the workaround is easy. Perhaps the PHP5 wrappers don't include methods which the compiler automatically synthesises, but I don't have time to investigate at present. > I admit that looking at the generated ptr.php I don't really > understand how to use it (the equivalent Python code is much more > clear -- but maybe it's subjective feeling influenced by the fact that > it also works unlike PHP version...). Patches to improve the generated PHP code welcome! Part of the problem is that the PHP5 classes wrap the flat function interface to C++ classes which SWIG already produced for PHP4 with "-noproxy". I resisted changing the flat function interface stuff more than I had to so as to minimise the risk of breaking PHP4 support. Once PHP4 support becomes irrelevant (probably less than a year from now) this could probably be improved. Cheers, Olly |