This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Static vs Shared Libraries on HPUX


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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]