Usenet comp.unix.osf.misc (1992-2004)
 help / color / mirror / Atom feed
* trouble with 'external read only' in dynamic library - segv
@ 1997-10-05  4:00 Jochen Küpper
  1997-10-06  4:00 ` Martin Knoblauch
  0 siblings, 1 reply; 3+ messages in thread
From: Jochen Küpper @ 1997-10-05  4:00 UTC (permalink / raw)



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
-----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: trouble with 'external read only' in dynamic library - segv
  1997-10-06  4:00 ` Martin Knoblauch
@ 1997-10-06  4:00   ` Jochen Küpper
  0 siblings, 0 replies; 3+ messages in thread
From: Jochen Küpper @ 1997-10-06  4:00 UTC (permalink / raw)
  To: Martin Knoblauch


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
-----------------------------------------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: trouble with 'external read only' in dynamic library - segv
  1997-10-05  4:00 trouble with 'external read only' in dynamic library - segv Jochen Küpper
@ 1997-10-06  4:00 ` Martin Knoblauch
  1997-10-06  4:00   ` Jochen Küpper
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Knoblauch @ 1997-10-06  4:00 UTC (permalink / raw)
  To: Jochen K�pper

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1588 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    |
+---------------------------------------------------------------------+



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-10-06  4:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-10-05  4:00 trouble with 'external read only' in dynamic library - segv Jochen Küpper
1997-10-06  4:00 ` Martin Knoblauch
1997-10-06  4:00   ` Jochen Küpper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox