[C++-SIG] HELP: wrapping with CXX, multiple inheritance issue
Ben
skeltobc at mailandnews.com
Wed Jun 7 19:25:16 CEST 2000
Hi
I am using CXX-4.2 to wrap a c++ library, but Im having some troubles with
multiple inheritance issues. This is what I have:
class BaseObjectWrapper
: public PythonExtension<BaseObjectWrapper>,
public BaseObjectInLibrary {
public:
BaseObjectWrapper ();
virtual ~BaseObjectWrapper ();
Py::Object PythonMethod1 (const Py::Tuple& args);
Py::Object PythonMethod2 (const Py::Tuple& args);
static void init_type (void);
STD::string asString () const;
virtual Py::Object repr ();
};
and
class DerivedObjectWrapper
: public PythonExtension<DerivedObjectWrapper>,
public DerivedObjectInLibrary,
public BaseObjectWrapper {
public:
DerivedObjectWrapper ();
virtual ~DerivedObjectWrapper ();
Py::Object PythonMethod3 (const Py::Tuple& args);
Py::Object PythonMethod4 (const Py::Tuple& args);
static void init_type (void);
STD::string asString () const;
virtual Py::Object repr ();
};
DerivedObjectWrapper inherits BaseObjectWrapper and in the library
DerivedObjectInLibrary inherits BaseObjectInLibrary.
Now when I compile, I get this:
../../../cxx/CXX-4.2/Include/CXX_Extensions.h: In function `static void
Py::Pyth
onExtension<DerivedObjectWrapper>::extension_object_deallocator(PyObject *)':
../../../cxx/CXX-4.2/Include/CXX_Extensions.h:528: instantiated from
`Py::Pyth
onExtension<DerivedObjectWrapper>::behaviors()'
../../../cxx/CXX-4.2/Include/CXX_Extensions.h:497: instantiated from
`Py::Pyth
onExtension<DerivedObjectWrapper>::type_object()'
../../../cxx/CXX-4.2/Include/CXX_Extensions.h:516: instantiated from
`Py::Pyth
onExtension<DerivedObjectWrapper>::PythonExtension()'
pythonwrapper.cpp:63: instantiated from here
../../../cxx/CXX-4.2/Include/CXX_Extensions.h:673: type
`DerivedObjectWrapper' is ambiguous bas
eclass of `PyObject'
plus a whole lot of warnings about ambiguous behaviours () and
add_varargs_method () due I guess to references to these methods from
PythonExtension<DerivedObjectWrapper> as well as
PythonExtension<BaseObjectWrapper> via the BaseObjectWrapper inheritance.
Line 63 in pythonwrapper.cpp is the point where the constructor is defined. I
can handle the ambiguity in DerivedObjectWrapper::init_type, but I don't know
what I should be doing with the constructor. Ive programmed some in C++
before finding Python but Ive never attempted to use C++'s tricky stuff.
I could of course just lose the BaseObjectWrapper inheritance in
DerivedObjectWrapper and rewrite the BaseObjectWrapper methods in
DerivedObjectWrapper and other derived classes, but Im sure it's not supposed
to work that way.
Any help here would be appreciated.
cheers
--Ben
More information about the Cplusplus-sig
mailing list