On 29/11/09 7:50 PM, Sohail Somani wrote:
// constructs a new instance of UserClass in Python using magic
// but uses shared_ptr to keep alive
shared_ptr<Base> base(/* magic here */);

This seemed to work:

// Boost Python/C++
class_<Base,shared_ptr<Base> >("Base")
 .def(...)
;

# Python
class UserClass(Base):
  ...

// Back in C++
object = module["UserClass"]
shared_ptr<Base> ptr = extract<shared_ptr<Base> >(object());

I'll find out soon enough if it works like I'm expecting ;-)

--
Sohail Somani
http://uint32t.blogspot.com

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to