public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* multiple type_info objects for same class in dynamic library
@ 2004-10-17  8:38 toon.knapen
  0 siblings, 0 replies; only message in thread
From: toon.knapen @ 2004-10-17  8:38 UTC (permalink / raw)
  To: binutils

Inside a dynamic library (which is actually an extension module of 
python and thus loaded by means of the import command in python), I have 
a Base and Derived class. In following code inside this library

1) Derived* d = new Derived ;
2) std::cout << &typeid(*d) << ":" << typid(*d).name()<<'\n';
3) std::cout << &typeid(Derived) << ":" << typid(Derived).name()<<'\n';

line 2 and 3 shows that the type_info objects obtained are different 
although the 'name()' member function provide the exact same name.

I'm using gcc 3.2 and python 2.3.3, the executable is linked with the 
'-E' option (although I'm not sure if this is relevant since the Derived 
class is only known in dynamic libraries but not to the executable), the 
-Bsymbolic option is not used when linking.

My question now is: how can I analyse what happens with the different 
weak symbols corresponding to the type_info object of the Derived class? 
Since line 2 and 3 print different addresses, there must be multiple 
type_info objects in the loaded program for the Derived class. In 
multiple libraries, I can see a weak symbol _ZTSDerived (using nm it has 
the symbol type 'V'). But all libraries have this same weak symbol so 
why does the loaded program end up with multiple of these symbols (since 
I obtain multiple addresses)?

Any idea would be very much appreciated. Thanks in advance.

Toon Knapen

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-10-17  8:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-17  8:38 multiple type_info objects for same class in dynamic library toon.knapen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).