This is the mail archive of the
mailing list for the GCC project.
Duplicate data objects in shared libraries
"David Abrahams" <firstname.lastname@example.org> writes:
> When I added the initializer as you suggest, the "C" language example
> produces the same results as the C++ one.
And not surprisingly so. Still, to make you better understood, I
recommend that you:
a) put all object files into a single directory,
b) in the C-only case (weak.tgz), drop the path to gcc - this has
nothing to do with a specific gcc release
c) drop the usage of C99 features in main.c (declare all variables
d) if you want to keep the template example in the discussion:
drop the path to g++ (it's not specific for a g++ release, either)
[it turns out that you can also drop the __attribute__((weak)) in the
C example; it does not contribute to the behaviour]
I somewhat lost track as to what your problem is, though: earlier, you
said you accept that static members of class templates might be
duplicated at run-time, and that your problem is only with things you
cannot control (such as typeinfo objects). Why are static members of
template classes suddenly a problem?
Also, where do you suspect the bug now? GCC? glibc? Python? Your own