|
Boost : |
From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-03 08:18:31
Vesselin,
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:
http://www.boost.org/libs/python/doc/overriding.html
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.
-Dave
----- 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
> http://gcc.gnu.org/ml/gcc-bugs/1997-10/msg00172.html
> and the reply
> http://gcc.gnu.org/ml/gcc-bugs/1997-10/msg00173.html
>
> This contains the explanation of my problem. It seems that the wrapping
code
> in Boost.Python "forgets" to call the constructors of the base virtual
classes
> from their most derived classes (perhaps it does not understand they are
> virtual?), and if they are not called explicitly, the compiler tries to
call
> 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 acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk