Hi,
I was experimenting with shared objects on Solaris 2.6 using CC 5.0, and
I noticed that no matter what I did, shared objects were always missing
some symbols; specifically, implementations of inline template functions
(I think). I have created an example below:
$ cat inline.cpp
#include <string>
using std::string;
string::size_type
thing_with_string(string &s)
{
s += "How long";
s += '?';
return s.length();
$ CC +w2 -xO2 -KPIC -ztext -G -o inline.so inline.cpp -lCrun -lcQuote:}
$ ldd -r inline.so $ c++filt Can anyone confirm this, please? Or maybe even show me what I've missed? Cheers,
libCrun.so.1 => /usr/lib/libCrun.so.1
libc.so.1 => /usr/lib/libc.so.1
libw.so.1 => /usr/lib/libw.so.1
libdl.so.1 => /usr/lib/libdl.so.1
symbol not found:
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MII
(./inline.so)
/usr/platform/SUNW,Ultra-4/lib/libc_psr.so.1
symbol not found:
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MII
(./inline.so)
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MII
std::basic_string<char,std::char_traits<char>,std::allocator<char>
__1cDstdMbasic_string4Ccn0ALchar_traits4Cc__n0AJallocator4Cc___Hreplace6MII
char*std::basic_string<char,std::char_traits<char>,std::allocator<char>
I think that this must be a compiler bug, because I have searched
docs.sun.com extensively and the part about building shared libraries is
very brief: no gotchas such as the above at all. It seems to expect
everything to "just work", the way that it "just works" for executables.
Unfortunately, I *cannot* have unresolved symbols in this object because
I need to load it via dlopen().
We haven't patched our compiler since February 2000 and I know that
there has been a new compiler patch released in the last month, so if
anyone who *has* installed the patch can confirm / refute this problem
then that would be useful too.
Chris