http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46097

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-10-21 
15:28:05 UTC ---
I'm not on gcc-help, but I assume Alexey's looking at this report now ...

> I would expect that TWO different instances of the global variable would
> be created in TWO different shared libraries - maybe with name mangling.

No, the compiler can't just add random mangling to symbols, that would mean the
linker can't find symbols!

If you want those objects to be distinct, put them in distinct namespaces
(possibly anonymous namespaces) to disambiguate them, as mentioned at
http://gcc.gnu.org/faq.html#dso
Otherwise you have an ODR violation due to two definitions of the same object.

Reply via email to