TAL Programmer's Guide

Compiling With Relocatable Data Blocks
Compiling Programs
14–16 096254 Tandem Computers Incorporated
Declaring Unblocked Data
Place all unblocked global declarations (those not contained in BLOCK declarations)
before the first BLOCK declaration. Unblocked declarations are relocatable and
shareable among all compilation units in a program.
Here is an example of unblocked data declarations:
INT a;
INT .b[0:9];
INT .EXT c[0:14];
LITERAL limit = 32;
The compiler places unblocked data declarations in implicit primary data blocks. As
of the D20 release, the compiler creates implicit data blocks as follows:
A data block named #GLOBAL for all unblocked declarations except template
structures. A compilation unit can have only one #GLOBAL block.
A data block for each unblocked template structure declaration. The data block
for a given template structure is given the template name prefixed with an
ampersand (&).
You can bind object files compiled with and without template blocks with no loss of
information. You can use Binder commands to replace the #GLOBAL and template
blocks in the target file.
Referencing Declarations
A referral structure and the structure layout to which it refers can appear in different
data blocks. The structure layout must appear first.
In all other cases, a data declaration and any data to which it refers must appear in the
same data block. The following declarations, for example, must appear in the same
data block:
INT var; !Declare VAR
INT .ptr := @var; !Declare PTR by referring to VAR
Allocating Global
Data Blocks
When you compile a program, the compiler constructs relocatable blocks of code and
data that are bound into the object file. The compiler:
Allocates each read-only array in its own data block in the user code segment in
which the array is referenced
Allocates all other variables in relocatable global data blocks in the user data
segment (except LITERALs and DEFINEs, which require no storage space)
In the user data segment, the compiler creates and names global data blocks that are
primary, secondary, or extended.