Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-10-03 09:53:23


Hi all,

I have some general questions about dynamic linking and RTTI (this is
related to the future of the Boost.Python library, but you may be able to
help anyway). Since dynamic linking isn't covered by the C++ standard, I
need to get a sense of the state of the art in existing implementations. The
question is this:

If I want to dynamic_cast<> between classes defined in different shared
libraries/DLLs, is it important that these be dynamically linked to through
a common base class exported from a single place?

For example, suppose I have a base class B and derived classes C and D, each
of which is defined and created in a shared library corresponding to its
name (libB, libC, libD). Could I expect to successfully dynamic_cast a B* to
a C* or D* in code linked into any arbitrary one of these libraries, even if
B wasn't exported from libB?

I can imagine implementations that would work, and others that wouldn't.

I guess this only applies to platforms under which dynamic libraries can
export things selectively (windows - anything else?)

Thanks in advance,
Dave

===================================================
  David Abrahams, C++ library designer for hire
 resume: http://users.rcn.com/abrahams/resume.html

        C++ Booster (http://www.boost.org)
          email: david.abrahams_at_[hidden]
===================================================


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk