help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dynamic_cast from base to another parent of derived class


From: Maxim Yegorushkin
Subject: Re: dynamic_cast from base to another parent of derived class
Date: 20 Oct 2006 04:21:24 -0700
User-agent: G2/1.0

skaller wrote:

> Boris, this is a very general problem in C++, coupled with
> both compiler, library, and linker problems. It's all about
> requirements for uniqueness.
>
> Here is a formula to make it all work reliably,
> but first definitions:
>
> A *module* is either a shared library or executable
>
> A type is *critical* if it is shared between modules
> and must be unique.
>
> * Do not use inline functions for critical types
>   -- this forces the RTTI and vtable to be in
>      a specific object file
>
> * if two libraries A,B share some critical entity X, X must
>   be instantiated in a third library D on which
>   both A and B depend: they must be linked against D
>   at compile time.
>
> If you follow these rules everything will work.

What about weak symbols? Do not they exist to solve this very problem
when multiple modules export the same symbol? If a symbol is a weak
symbol in all the modules, which is true for typeinfo objects, all the
references to that symbol are resolved to the first one found by ld.so.
Am I missing something?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]