Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-03 08:18:31


I understand now; since you didn't tell me you had virtual base classes, it
was difficult to guess what your problem might have been.

Yes, there's no way for Boost.Python to know automatically that your class
has a virtual base.

I think one way for you to "tell it" might be to use the optional 2nd
parameter to the class_builder<> template as described here:

I also think it should be possible to make the default type used for that
2nd parameter (boost::python::detail::held_instance<T>) contain a T by value
instead of using inheritance, which is what causes your problem. When I was
designing that part of the library I don't think there was a compelling
reason to choose one approach over the other, but virtual inheritance seems
to provide one ;-). It will be some time before I am able to try to make
that change, but perhaps you, or one of the other Boost.Python developers
can take a stab at it.

FWIW, please in future post Boost.Python questions and problems to the boost
list. Right now I am taking more of an advisory role as others who have more
of a stake in Boost.Python for their current work are taking the lead in
maintenance and development.


----- Original Message -----
From: "Vesselin Iliev Peev" <VesselinPeev_at_[hidden]>
To: <david.abrahams_at_[hidden]>
Sent: Friday, August 03, 2001 1:31 AM
Subject: I think I have the explanation

> Dave,
> Please see
> and the reply
> This contains the explanation of my problem. It seems that the wrapping
> in Boost.Python "forgets" to call the constructors of the base virtual
> from their most derived classes (perhaps it does not understand they are
> virtual?), and if they are not called explicitly, the compiler tries to
> the default constructor, so one
> must exist.
> BTW my C++ code correctly calls the virtual base classes, so that's why it
> works.
> I do not know the details of fixing Boost.Python, however. I'm counting on
> you...
> All the best,
> Vesselin I. Peev

Boost list run by bdawes at, gregod at, cpdaniel at, john at