ld Manual

Introduction to ld
ld Manual529650.001
1-23
ld Compilation Rules
ld Compilation Rules
ld enforces separate compilation rules for linking native programs in C, C++, COBOL,
and pTAL.
Case-Sensitivity
C and C++ are case-sensitive; COBOL and pTAL are not. In C and C++, the symbol
names x and X refer to different symbols. In COBOL and pTAL, all symbol names are
converted to uppercase letters, so x and X refer to the same symbol.
Local and Shared Symbols
A local symbol is known only within a single compilation unit. A shared symbol is
known by all compilation units that are linked together.
A local symbol is distinct from any other symbol of the same name that appears in
other compilation units. Because a shared symbol is known by all compilation units that
are linked together, all compilation units refer to the same symbol at run time.
The pTAL compiler has various rules for grouping data items into blocks. You can
declare separate data items in pTAL, outside any explicit data blocks, and have them
remain individual data items across separate compilation units. (This behavior is
identical to that in C and C++.) The pTAL compiler can also group data items together
into a single data block named _GLOBAL. The pTAL compiler can also put the prefix “$
on the name of a data block. See the pTAL Reference Manual for details on declaring
and sharing data blocks in pTAL.
Table 1-4. Local and Shared Symbols by Language
Language Local Symbols: Names of ... Shared Symbols: Names of ...
C
C++
Static data items
Static functions
Data items declared outside functions
All other functions
COBOL Data records (level 01 data items) that
are not declared external
Subordinate data items (levels 02-nn)
Programs nested within other
programs
External data items
External file connectors
pTAL Private data blocks whose NAME
declarations are unique
Subprocedures
Names of data block members*
All other data blocks
* For example, if a data block is named B and it contains an integer named I, B is the only name that ld
considers for separate compilation rules. It is possible that B will be confused with a data item named B in C
compilation units.