Chapter Contents

Previous

Next
Compiling C and C++ Programs

External Compiler Variables

Older versions of OS/390 were limited to running with 24-bit addresses, giving a maximum virtual address space of 16 megabytes. With the release of MVS/XA the addresses were increased to 31 bits giving a virtual address space maximum of 2 gigabytes. Certain portions of OS/390 (notably certain I/O subsystems) were not modified to accept 31-bit addresses, therefore programs wishing to utilize these services were forced to get storage below the 16M line to use as parameters when calling these functions. Prior versions of SAS/C allocated all stack memory from the area below the line to avoid the problems involved in calling old OS/390 services with 31-bit addresses.

In SAS/C Release 6.50, defining the external integer variable _stkabv in the source program (example: extern int _stkabv = 1; ) will indicate to the library to allocate stack space above the 16M line.

Note:    Setting the variable at run time will have no effect; it must be initialized to 1 as shown.  [cautionend]
However, some SAS/C library functions require their stack space be allocated below the line due to their use of auto storage for parameter lists and control blocks which still have a below-the-line requirement. These library routines have been identified, and either modified to remove the requirement, or changed to request that their own allocation of stack space be located below the 16M line. Release 6.50 includes a compiler option and a CENTRY macro parameter to allow user code to request that its stack space be allocated below the line even if the _stkabv variable is defined as non-zero.

A new option allows the library to release stack space that is no longer needed. To free stack space, define the external integer variable _stkrels (example: extern int _stkrels = 1; ). This tells the library that, on return from a function, if an entire stack segment becomes unused, the segment should be returned to the operating system. This option is useful in long running programs that contain code paths that can occasionally become deeply nested, or in multi-tasking applications. Use of _stkrels and _stkabv guarantee that no stack space is allocated below the line if none is required by an executing routine.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.