From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5392,e68dcc26d9ac3dc5,start X-Google-Attributes: gidf5392,public X-Google-Thread: 10c696,e68dcc26d9ac3dc5,start X-Google-Attributes: gid10c696,public X-Google-Thread: fc89c,e68dcc26d9ac3dc5,start X-Google-Attributes: gidfc89c,public X-Google-Thread: 101151,e68dcc26d9ac3dc5,start X-Google-Attributes: gid101151,public X-Google-Thread: f97d0,e68dcc26d9ac3dc5,start X-Google-Attributes: gidf97d0,public X-Google-Thread: f65d0,e68dcc26d9ac3dc5,start X-Google-Attributes: gidf65d0,public X-Google-Thread: f678f,e68dcc26d9ac3dc5,start X-Google-Attributes: gidf678f,public From: Jochen =?iso-8859-1?Q?K=FCpper?= Subject: trouble with 'external read only' in dynamic library - segv Date: 1997/10/05 Message-ID: <34379D50.41C6@uni-duesseldorf.de>#1/1 X-Deja-AN: 278545508 Organization: =?iso-8859-1?Q?Heinrich=2DHeine=2DUniversit=E4t?=, Physikalische Chemie Newsgroups: comp.unix.programmer,comp.os.linux.development.apps,comp.unix.osf.misc,comp.os.linux.development.system,de.comp.os.unix,gnu.g++,gnu.gcc 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 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 -----------------------------------------------------------------------