Hi! I am trying to expose some c++ classes with boost.python. Unfortunately, i have some trouble with the inheritance of classes which need a wrapper. It is something like that: class Base { public: void someFunction() { doSomething; } }; class BaseWrapper : public Base, boost::python::wrapper<Base> { public: //constructor here void someFunctionWrapped() { doSomeThing and call Base::someFunction(); } private: PyObject *self; }; class Derived : public Base {}; class DerivedWrapper : public Derived, boost::python::wrapper<Derived> { public: //constructor here private: PyObject *self; }; BOOST_PYTHON_MODULE( myModule ) { class_<Base, BaseWrapper ("Base", init<>() ) .def( "someFunction", &BaseWrapper::someFunctionWrapped); class_<Derived, DerivedWrapper, bases<Base> > ("Derived", init<>()); } In Python: import myModule derived = myModule.Derived() derived.someFunction() This crashes with a signature error: Boost.Python.ArgumentError: Python argument types in Base.someFunction(Derived) did not match C++ signature: someFunction(isis::python::BaseWrapped {lvalue}) If the function (here someFunction(Wrapped) ) was not declared in the wrapper class, it works. But unfortunately i need it there. Is someone aware of this problem and can give me a hint? Thanks for your help! Best regards! Erik Türke Department of Neurophysics Max-Planck-Institute for Human Cognitive and Brain Sciences Stephanstrasse 1A 04103 Leipzig Germany Tel: +49 341 99 40-2440 Email: tuerke@cbs.mpg.de www.cbs.mpg.de
participants (1)
-
Erik Türke