help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

string STL assignment in g++ shared object crashes with core


From: Nilesh
Subject: string STL assignment in g++ shared object crashes with core
Date: 20 Sep 2006 08:10:22 -0700
User-agent: G2/1.0

Hi

I am using my own shared object to link it dynamically to a program
exe. The EXE makes a call to function in .so, in which l_str=
"somestring"; code causes a core. When backtraced in gdb it shows
libc.a

g++ -v output: gcc version 4.1.1
=========================
Using built-in specs. Target: powerpc-ibm-aix5.2.0.0 Configured with:
../gcc-4.1.1/configure --disable-aix64 --disable-nls   Thread model:
aix

the way I build .so is like this:
======================
g++ -D_DEBUG -g -shared -o libiif.so -O3 -v -Wl,-bexpfull -Wl,-G
-Wl,-brtl ../src/BMCIIF_Source.d -L/usr/lib/threads -L../lib_aix
-L../lib -L/usr/local/lib -L/usr/lib  -lstdc++ -liiapi  -lm -lnsl
-lpthread  -lnsl  -lm -lc -ltli

-liiapi is another c shared object containg only C code no STL at all.

The way I use it in EXE is as follows:
============================
g++ -o PROGRAMEXE../src/main.o -O3 -v  -L/usr/lib/threads
-L/usr/local/lib -L/usr/lib -L./../../libs/aix -lstdc++ -lgcc -lgcc_eh
-liiapi -lm -lnsl -lpthread -lc
-Wl,-blibpath:/home/work/product/libs/aix -Wl,-brtl -liif

-liif is the above .so , to which PROGRAMEXE links to.

After running this it gives a core at the source code containing
following code in BMCIIF_Source.cpp:
string l_str;
l_str = "somethingstring";

The core trace shows:
=================
Program terminated with signal 11, Segmentation fault.
#0  0xd025deb8 in ?? () from /usr/lib/libc.a(shr.o)
(gdb) bt
#0  0xd025deb8 in ?? () from /usr/lib/libc.a(shr.o)
(gdb)

Is there any problem the way .so or exe is being linked?
Thanks in advance
Nilesh



reply via email to

[Prev in Thread] Current Thread [Next in Thread]