#include "ClassDefs.hh" #include #include namespace python = boost::python; namespace { BOOST_PYTHON_MODULE_INIT(Second) { try { python::module_builder secondmodule("Second"); // Import the two base classes from the Base module. python::import_converters AbstractBaseConverters("Base", "AbstractBase"); python::import_converters DefiniteBaseConverters("Base", "DefiniteBase"); // Wrap DerivedClass python::class_builder DerivedClassBoost(secondmodule, "DerivedClass"); // DerivedClassBoost.declare_base(AbstractBaseConverters); // This doesn't compile! DerivedClassBoost.def(python::constructor<>()); // Wrap UseAbstractType python::class_builder UseAbstractTypeBoost(secondmodule, "UseAbstractType"); UseAbstractTypeBoost.def(python::constructor()); UseAbstractTypeBoost.def(&UseAbstractType::callPureMethod, "callPureMethod"); // Wrap AnotherDerivedClass python::class_builder AnotherDerivedClassBoost(secondmodule, "AnotherDerivedClass"); AnotherDerivedClassBoost.declare_base(DefiniteBaseConverters); // This doesn't compile! AnotherDerivedClassBoost.def(python::constructor<>()); // Wrap UseDefiniteType python::class_builder UseDefiniteTypeBoost(secondmodule, "UseDefiniteType"); UseDefiniteTypeBoost.def(python::constructor()); UseDefiniteTypeBoost.def(&UseDefiniteType::callMethod, "callMethod"); } catch(...) { python::handle_exception(); } } }