This is the mail archive of the gcc-help@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]

Segmentation fault of shared libraries


Hi, folks

I used gcc/g++ 2.8.1 to build a shared library under solaris 7 x86 like:
g++ -g -D_REENTRANT -fpic -shared -o libmylib.so file1.o file2.o

Then I used a main.cpp to test the shared library like
g++ -g -o main main.cpp -lmylib

But when I run 'main', I got 'Segmentation fault (core dumped)'.
It happens even before main() function gets executed. I guess
it happens when the run-time system tries to load the shared
library libmylib.so. ( I tried to use dlopen("libmylib.so",RTLD_LAZY),
the same problem happened when dlopen was called )

Could anyone help me how to figure this out? Are there any
special compiler or linker switches to build the shared library?

Thanks in advance.

-Song


Sent via Deja.com http://www.deja.com/
Before you buy.


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