The compiler wants to put all external variables into WSA. To turn that off 
specify norent.

#pragma variable(FOO,norent)
extern const long FOO;

On 18/11/2014 9:31 AM, Charles Mills wrote:
I have a C++ program. I have three "global" constants that I wish to define
in assembler modules. Environment: prelinker, non-XPLINK, RENT.

Here is what I am doing now:

In the C++ at namespace scope:

extern const long FOO;

In the Assembler:

FOO      DC    F'123'
          ENTRY FOO

The error I am getting from the prelinker is ERROR EDC4014: Undefined
writable static objects are detected: FOO

I suspect this is due to the fact that the C++ compiler and link magically
make static variables reentrant: if you say static int bar there is actually
one copy of bar for each executing instance of your program.

Does anyone know if there is some linkage or similar that I need to specify
on the extern declaration?

RTFM not much help -- everything I see refers to subroutines in Assembler,
not variables. Worst case I can wrap subroutines around the variables and
return their values, but that seems a little silly. (I have a lot of
experience with calling Assembler from C++.)

Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to