Hello. I'm new to Python, but really want to use it with my C++ code.
I faced a problem while returning pointer to abstract class from pure virtual class method. I tried to search the web, but found nothing. struct ICoreWrapper : ICore, wrapper<ICore> { virtual IRegistry* CreateRegistry() { return this->get_override("CreateRegistry")(); } }; struct IRegistryWrapper : IRegistry, wrapper<IRegistry> { virtual void DoSomestuff() { return this->get_override("DoSomestuff")(); } }; ICore* CreateCoreW() { return new CCore; } BOOST_PYTHON_MODULE_INIT(CorePy) { class_<IRegistryWrapper, boost::noncopyable>("IRegistry") .def("DoSomestuff", pure_virtual(&IRegistry::DoSomestuff)) ; class_<ICoreWrapper, boost::noncopyable>("ICore") .def("CreateRegistry", pure_virtual(&ICore::CreateRegistry), return_value_policy<reference_existing_object>()) ; def("CreateCore", CreateCoreW, return_value_policy<reference_existing_object>()); } The Python code looks like this: >>> import CorePy >>> c = CorePy.CreateCore() >>> b = c.CreateRegistry() I get Debug Error Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention. Please tell me what I do wrong. Or whether this code is supported or not. Thanks Roman Hwang. _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig