This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Static vs Shared Libraries on HPUX
- To: egcs at cygnus dot com, egcs-bugs at cygnus dot com
- Subject: Static vs Shared Libraries on HPUX
- From: Gcc <gcc at sunburst dot rose dot hp dot com>
- Date: Thu, 13 Nov 1997 14:14:19 -0800 (PST)
I have an application which builds into shared libary. However, it will
always crash when it an application tries to use the shared library.
Although if I create an static library(.a file) and link it into the
application everything runs smoothly. The application will work perfectly
if I take out a static reference to an STL list. However, I prefer not to
because it should be the compiler's job :). This bug exists on all
versions of gcc and egcs. I've heard u can do this __atribute(weak) thing
but I have no idea how.
Sample Code(I'm not sure if this will crash or not I am just writing it
off hand, Although I could provide other examples to prove the point):
crashtest.h
#include <iostream.h>
#include <list>
#include <string>
class CrashTest {
CrashTest();
~CrashTest();
private:
static list <string> crashList;
};
crashtest.cpp
list<string> CrashTest::crashList;
CrashTest::CrashTest() {
cout << crashList.size();
}
I would love to see egcs fix this problem. This bug is a major
hassle on big developmental projects which use STL, templates with shared
libraries.
Kindly Regards,
Sam Yu