[C++-sig] Cross-module inheritance
dave at boost-consulting.com
Sun Aug 21 17:25:29 CEST 2005
Eric Jardim <ericjardim at gmail.com> writes:
> Hi again,
> I searched google and discovered that the problem is
> real. Cross-module inheritance and some other things do not work
> with boost.python (I don't know why).
It certainly does work; you just have to follow some rules when you
build your extensions to make sure their RTTI info is properly shared.
> Some old posts show it:
That was for Boost.Python v1. You are (I hope) using the improved
> And recent posts show that some guys resolved the problem (partially):
> import sys, dl
This is the brute-force method. A more delicate and portable approach
is to stick the common base class in a shared library that is linked
to by all the extension modules that derive from it.
> But, I am afraid this is not a portable solution.
> 1 - Could anyone tell me if, at least, this solution is portable among gcc
> compilation, even on Windows?
No, the Windows dynamic linking system is different. However, the
approach I suggested above works fine.
> 2 - Does anyone suggest me to use this trick now, or should I stay with the
> "single-module", and wait for this issue to be solved (is it possible, given
> boost.python current state?)
There is no "solving it" further; it has nothing to do with the state
of Boost.Python. It has to do with the way shared libraries and
run-time type information work on your platform.
> 3 - Is there any other workaround? It looks like SWIG can do it (am I
> 4 - Should I give up everything? ( hope not ;)
It's a little early for that yet.
More information about the Cplusplus-sig