T
Thomas Lenarz
Hello,
please forgive me for posting this if this problem has come up before.
I could not find any hint with google.
I am porting a bunch of source-code from SUN-OS to AIX at the moment
and have the following situation (simplified and renamed for better
understanding)
Source a.cc --> compiled and linked into a binary together with the
shared object underneath
.....
AnyType *globalAnyType;
....
Source b.cc --> compiled and linked into a shared object:
....
extern AnyType *globalAnyType;
....
globalAnyType = new AnyType(....); <----- Segment-Violation here
On SUN the code worked fine. On AIX I get no compile-errors and no
link errors. So I assume external references are resolved.
I found out using dbx that the assignment from "new AnyType(...)" to
globalAnyType causes the Segment-Violation. The external declared
globalAnyType appears not to be backed up by memory (dbx shows "nil").
To proove this I replaced globalAnyType by a non-extern-declared
variable of Type AnyType and....that works.
Does anyone have got an idea on why external binding of a variable
does not work in this case? Are there circumstances you can think of?
Might special compiler/linker options help?
I have to mention that I port from an old compiler without
namespace-support to a compiler with namespace-support. I already
checked if the variables may be in different namespaces because of
side effects of include files. But I concluded that this would be
logically impossible.
Thanks for any idea what I could try.
Cheers
Thomas
please forgive me for posting this if this problem has come up before.
I could not find any hint with google.
I am porting a bunch of source-code from SUN-OS to AIX at the moment
and have the following situation (simplified and renamed for better
understanding)
Source a.cc --> compiled and linked into a binary together with the
shared object underneath
.....
AnyType *globalAnyType;
....
Source b.cc --> compiled and linked into a shared object:
....
extern AnyType *globalAnyType;
....
globalAnyType = new AnyType(....); <----- Segment-Violation here
On SUN the code worked fine. On AIX I get no compile-errors and no
link errors. So I assume external references are resolved.
I found out using dbx that the assignment from "new AnyType(...)" to
globalAnyType causes the Segment-Violation. The external declared
globalAnyType appears not to be backed up by memory (dbx shows "nil").
To proove this I replaced globalAnyType by a non-extern-declared
variable of Type AnyType and....that works.
Does anyone have got an idea on why external binding of a variable
does not work in this case? Are there circumstances you can think of?
Might special compiler/linker options help?
I have to mention that I port from an old compiler without
namespace-support to a compiler with namespace-support. I already
checked if the variables may be in different namespaces because of
side effects of include files. But I concluded that this would be
logically impossible.
Thanks for any idea what I could try.
Cheers
Thomas