From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII X-Google-Thread: f5392,e68dcc26d9ac3dc5 X-Google-Attributes: gidf5392,public X-Google-Thread: 10c696,e68dcc26d9ac3dc5 X-Google-Attributes: gid10c696,public X-Google-Thread: fc89c,e68dcc26d9ac3dc5 X-Google-Attributes: gidfc89c,public X-Google-Thread: f97d0,e68dcc26d9ac3dc5 X-Google-Attributes: gidf97d0,public X-Google-Thread: 101151,e68dcc26d9ac3dc5 X-Google-Attributes: gid101151,public X-Google-Thread: f678f,e68dcc26d9ac3dc5 X-Google-Attributes: gidf678f,public X-Google-Thread: f65d0,e68dcc26d9ac3dc5 X-Google-Attributes: gidf65d0,public From: Martin Knoblauch Subject: Re: trouble with 'external read only' in dynamic library - segv Date: 1997/10/06 Message-ID: <343896FD.92818F2D@munich.sgi.com>#1/1 X-Deja-AN: 278747586 References: <34379D50.41C6@uni-duesseldorf.de> To: "Jochen K�pper" Organization: Silicon Graphics GmbH, Am-Hochacker 3, D-85630 Grasbrunn 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 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 > 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: | VM: 6-333-8179 | M/S: IDE-3150 | +---------------------------------------------------------------------+