Thread View: comp.unix.programmer
3 messages
3 total messages
Started by Jochen Küpper
Sun, 05 Oct 1997 00:00
trouble with 'external read only' in dynamic library - segv
Author: Jochen Küpper
Date: Sun, 05 Oct 1997 00:00
Date: Sun, 05 Oct 1997 00:00
75 lines
3088 bytes
3088 bytes
Dear All,
I am using g++ and libg++ for software development.
PROBLEM:
=3D=3D=3D=3D=3D=3D=3D=3D
I am trying to put some arrays into a library, one of the array is
defined as:
#include <string>
const string symbol[] =3D { " ",
"h ", "he", "li", "be", "b ",
"c ", "n ", "o ", "f ", "ne",
"na", "mg", "al", "si", "p ",
"s ", "cl", "ar"
};
If I put that into an object file archive, everything is working as
expected,
but if I create a dynamic link library, I get a segmatation fault
whenever I =
try to access the array. But the array is in the library:
'nm /usr/local/lib/libJochen.so.0.2 |grep masses'
masses | 0004398046251768 | R |
0000000000000152
'man nm' says
R - [Digital] External read only
System:
=3D=3D=3D=3D=3D=3D=3D
'uname -a'
OSF1 bacchus.pc1.uni-duesseldorf.de V4.0 564 alpha
'g++ -v'
gcc -v
Reading specs from
/usr/local/lib/gcc-lib/alpha-dec-osf4.0/2.7.2.3.f.1/specs
gcc version 2.7.2.3.f.1
'll /usr/local/lib/lib*++*' (snipped the beginning of the lines)
/usr/local/lib/libg++.a
/usr/local/lib/libg++.so -> libg++.so.2.7.2
/usr/local/lib/libg++.so.2.7.2
/usr/local/lib/libstdc++.a
/usr/local/lib/libstdc++.so -> libstdc++.so.2.7.2
/usr/local/lib/libstdc++.so.2.7.2
The same is happening on my Linux box at home - running Linux 2.0.20,
glibc-2.0.5, gcc-2.7.2.3
and libg++-2.7.2.8.
Any idea what I am doing wrong ?
Jochen
-----------------------------------------------------------------------
Jochen K=FCpper
Heinrich-Heine-Universit=E4t D=FCsseldorf jochen@uni-duesseldorf.de=
Institut f=FCr Physikalische Chemie I
Universit=E4tsstrasse 1, Geb 26.43.02.19 phone ++49-211-8113681
40225 D=FCsseldorf fax ++49-211-8115195
Germany http://www-public.rz.uni-duesseldorf.de/~jochen
-----------------------------------------------------------------------
Re: trouble with 'external read only' in dynamic library - segv
Author: Jochen Küpper
Date: Mon, 06 Oct 1997 00:00
Date: Mon, 06 Oct 1997 00:00
24 lines
2043 bytes
2043 bytes
Martin Knoblauch wrote: > = > how are you building the DLL? Your problem sounds like the > initialization routine for that array is never called. On our > (SGI) platform, the rule is to use the C++ compiler to link > the library. Yeah, seems to be correct. Using the c++ - compiler gives a working library. Dankesch=F6n, Jochen ----------------------------------------------------------------------- Jochen K=FCpper Heinrich-Heine-Universit=E4t D=FCsseldorf jochen@uni-duesseldorf.de= Institut f=FCr Physikalische Chemie I Universit=E4tsstrasse 1, Geb 26.43.02.19 phone ++49-211-8113681 40225 D=FCsseldorf fax ++49-211-8115195 Germany http://www-public.rz.uni-duesseldorf.de/~jochen -----------------------------------------------------------------------
Re: trouble with 'external read only' in dynamic library - segv
Author: Martin Knoblauch
Date: Mon, 06 Oct 1997 00:00
Date: Mon, 06 Oct 1997 00:00
45 lines
2753 bytes
2753 bytes
Jochen K�pper wrote:
>
> Dear All,
>
> I am using g++ and libg++ for software development.
>
> PROBLEM:
> ========
>
> I am trying to put some arrays into a library, one of the array is
> defined as:
>
> #include <string>
> const string symbol[] = { " ",
> "h ", "he", "li", "be", "b ",
> "c ", "n ", "o ", "f ", "ne",
> "na", "mg", "al", "si", "p ",
> "s ", "cl", "ar"
> };
>
> If I put that into an object file archive, everything is working as
> expected, but if I create a dynamic link library, I get a
> segmatation fault whenever I try to access the array. But the
> array is in the library:
>
>
Jochen,
how are you building the DLL? Your problem sounds like the
initialization routine for that array is never called. On our
(SGI) platform, the rule is to use the C++ compiler to link
the library.
Martin
--
+---------------------------------+-----------------------------------+
|Martin Knoblauch | Silicon Graphics GmbH |
|Manager Technical Marketing | Am Hochacker 3 - Technopark |
|Silicon Graphics Computer Systems| D-85630 Grasbrunn-Neukeferloh, FRG|
|---------------------------------| Phone: (+int) 89 46108-179 or -0 |
|http://reality.sgi.com/knobi | Fax: (+int) 89 46107-179 |
+---------------------------------+-----------------------------------+
|e-mail: <knobi@munich.sgi.com> | VM: 6-333-8179 | M/S: IDE-3150 |
+---------------------------------------------------------------------+
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads