[Top][All Lists]

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

Re: dynamic_cast problem revisited:

From: Bernd Strieder
Subject: Re: dynamic_cast problem revisited:
Date: Tue, 08 Aug 2006 18:08:39 +0200
User-agent: KNode/0.10.1


Earl Purple wrote:

> Got it to work back then. Now I have built the libraries in
> 3.4.2-32Bit release mode and the error has recurred.

There have possibly been changes. Nobody knows what exactly you did to
get it to work, and nobody knows what exactly you have done now. So
basically this is all guesswork.

> I have no idea what to do because those switches -E etc never worked
> for me. I'm not an expert with makefiles. I just don't want
> optimisations forced upon me if they cause the code not to work.

I think the following page is still giving the best pointers, how this
has to be done. We had it in the old thread. 

That switch -E is meant for the linker, when linking with the compiler
driver you have to prefix it with -Wl,-E as the FAQ says. You may not
use -Wl,-Bsymbolic when building the shared library. Read the manpage
of ld, there are some short comments on this in the explanations of
-B... and -E. From those explanations it is clear that -E is very
important, because without it there is no chance that those type_info
objects from the executable get used by the shared library. The other
way, using the objects from the shared library is not possible, because
the objects from the executable could already be in use at the time it
is loaded. If dynamic cast works, then the dynamic linker must provide
the same resolution to those type_info objects, before and after
loading the shared library.

g++ -Wl,-E main.o blah.o foo.o -ldso

This will generate a call to ld like:

ld .... -E .... main.o blah.o foo.o .... -ldso ....

> So now what exactly am I supposed to do because I don't want to have
> to start putting crazy workarounds into my code simply because I can't
> find a decent compiler to build standard C++.

You are doing things that are not guaranteed to work everywhere, that
are non-standard. And it is more a linker problem.

Bernd Strieder

reply via email to

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