Chapter Contents

Previous

Next
Sharing extern Variables among Load Modules

L$UGLBL

L$UGLBL is an assembler language program that contains the list of global extern variables. The object code generated by L$UGLBL must be linked with every C load module. By default, this list contains only those global extern variables that are required by the library, such as a pointer to errno . Default Global extern Variables is a list of global extern variables that are defined by default.

All default global extern variables are defined as pointers. This allows a single copy of the variable to be defined in the primary load module. Because references to its value are always made via the pointer, all load modules that refer to the global extern refer to the current value. For example, the global extern __en points to an extern named errno in the primary load module. In <errno.h> , errno is a macro defined as (*__en) . Therefore, any reference to errno will always refer to errno in the primary load module.

Note:    Because the compiler changes underscores in external identifiers to pound signs (#), the # characters in these names correspond to underscores in the C identifier. For example, ##EN in L$UGLBL corresponds to __en in <errno.h> .  [cautionend]

Default Global extern Variables
Name Points to
##IO global I/O information
##CT ctype table
##EN errno
##MN _msgno
##MG miscellaneous information
#ENVIRON POSIX environment pointer address

For CICS applications only, there are three additional global extern variables in the L$UGLBL list. They are listed in Default CICS Global extern Variables. These additional global extern variables appear immediately after the default global extern variables in the L$UGLBL list.

Default CICS Global extern Variables
Name Points to
#EIBPTR CICS EXEC interface block
#COMMPTR CICS COMMAREA
#DOBPTR DL/I interface block

Another global extern variable has been added for users of the Generalized Operating System (GOS) feature. This new extern variable appears after the other default global extern variables; it only exists for users of GOS. The name of this extern is ##GA. ##GA points to the GOS anchor block.

The list in L$UGLBL can be extended to include those variables that are required by a specific site or application. The GLOBAL assembler macro, defined in L$UGLBL, is used to define additional entries. This macro adds a pseudoregister to the L$UGLBL list. This is the format of the GLOBAL macro instruction:

GLOBAL name,CUST=(YES|NO)

name is the name of the global extern . If the C identifier contains underscores, the corresponding characters in name must be pound signs ( # ).
CUST=YES indicates that name is a custom addition to the list. All additions to the global list must use this operand.
CUST=NO is reserved. This is the default.

For example, use the following code to add a global extern named gcb :

GLOBAL GCB,CUST=YES

All custom global extern variables must be defined at the end of the default list. Global extern variables are aligned on a doubleword boundary. Each global extern must be no more than 4 bytes long.

L$UGLBL is in SASC.SOURCE(L$UGLBL) under OS/390 and is member L$UGLBL of LSU MACLIB under CMS. Consult your SAS Software Representative for C compiler products for more information.


Chapter Contents

Previous

Next

Top of Page

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