Function Template Specialization and weak symbols
Ioannis Sismanis
isis@cs.umd.edu
Wed Nov 11 18:07:00 GMT 1998
Hi,
I am using egcs-1.1b on solaris 2.5 and I've noticed the following
problem: The linker produces many errors about multiple definitions of
symbols. All the symbols happen to be function template specializations
(defined in STL, eg. copy(const char*,...), lexicographical_compare(const
char*,...) etc.).
I've noticed that when it instantiates code for a function
template it is marked as 'WEAK'. This doesn't happen for specialized
template functions though -they are marked as global-.
To be more specific:
template <class T>
void foo(T op)
{}
template<>
void foo(char *)
{}
generates a GLOBAL symbol foo<char*>(char*).
the SGI'STL case is a little different but the effect is the same:
void foo(char*) //This is not a specialization, (I guess it should though)
{}
Any known cure? I've tried using __attribute__((weak)) inside STL header
files and it works fine, but it is ugly...
Yannis
More information about the Gcc-bugs
mailing list