TAL Programmer's Guide
Compiling With Relocatable Data Blocks
Compiling Programs
14–14 096254 Tandem Computers Incorporated
Compiling With
Relocatable Data
Blocks
When you compile modules of a program separately or bind TAL code with code
written in other languages, the binding process might relocate some of your global
data. All global data to be shared with compilation units written in other languages
must be relocatable.
Declaring Relocatable
Global Data
You can declare blocked and unblocked relocatable global data (variables, LITERALs,
and DEFINEs).
Blocked global data declarations are those appearing within BLOCK declarations.
BLOCK declarations let you group global data declarations into named or private
blocks. Named blocks are shareable among all compilation units in a program. The
private block is private to the current compilation unit. If you include a BLOCK
declaration in a compilation unit, you must assign an identifier to the compilation unit
by using a NAME declaration.
Unblocked global data declarations are those appearing outside a BLOCK declaration.
Such declarations are also relocatable and shareable among all compilation units in a
program.
If present in a compilation unit, global declarations must appear in the following
order:
1. NAME declaration
2. Unblocked global data declarations
3. BLOCK declarations
4. PROC declarations
Naming Compilation units
To assign an identifier to a compilation unit, specify the NAME declaration as the first
declaration in the compilation unit. (If no BLOCK declaration appears in the
compilation unit, you need not include the NAME declaration.) In the NAME
declaration, specify an identifier that is unique among all BLOCK and NAME
declarations in the target file. The following example assigns the identifier
INPUT_MODULE to the current compilation unit.
NAME input_module; !Name the compilation unit
Declaring Named Data Blocks
A named data block is a global data block that is shareable among all compilation
units in a program. You can include any number of named data blocks in a
compilation unit. To declare a named data block, specify an identifier in the BLOCK
declaration that is unique among all BLOCK and NAME declarations in the target file.
The following declaration assigns the identifier GLOBALS to the named data block:
BLOCK globals; !Declare named data block
INT .vol_array[0:7]; !Declare global data
INT .out_array[0:34];
DEFINE xaddr = INT(32)#;
END BLOCK;