TAL Programmer's Guide
Compiling With Relocatable Data Blocks
Compiling Programs
096254 Tandem Computers Incorporated 14–15
As of the D20 release, a variable declared in a named data block can have the same
name as the data block. Modules written in TAL can share global variables with
modules written in C by placing each shared variable in its own block and giving the
variable and the block the same name. Here is an example of a variable named the
same as the data block:
BLOCK c_var;
INT c_var;
END BLOCK;
Declaring Private Data Blocks
A private data block is a global data block that is shareable only among the procedures
within a compilation unit. You can include only one private data block in a
compilation unit. The private data block inherits the identifier you specify in the
NAME declaration. To declare a private global data block, specify the PRIVATE
option of the BLOCK declaration:
BLOCK PRIVATE; !Declare private global data block
INT term_num; !Declare global data
LITERAL msg_buf = 79;
END BLOCK;
Specifying the Data Block Location
You can use the AT and BELOW clauses to control where Binder locates a block. For
example:
AT (0)—to detect the use of uninitialized pointers
BELOW (64)]—to use XX (extended, indexed) machine instructions
BELOW (256)—to use directly addressed global data
For example, you can specify where to allocate data blocks as follows:
BLOCK ext_indexed_stuff BELOW (64); !Specify location
INT .EXT symbol_table[0:32760];
INT .EXT error_table[0:16380];
END BLOCK;
The following limitations apply to the AT and BELOW clauses:
Using the AT[0] option might cause conflicts if you:
Share data with compilation units written in other languages
Run your program in the CRE
Use 0D as nil for pointers
Some of the AT and BELOW clauses are not portable to future software platforms.