Shared Global Data [ Technical Addendum for HP Link Editor/iX ] MPE/iX 5.5 Documentation
Technical Addendum for HP Link Editor/iX
Shared Global Data
Shared global data are data definitions, initialized or uninitialized,
that are exported to or imported from other compilation units. The data
definitions are visible to other modules if the definitions are
exportable. This means that they are not marked as hidden and,
therefore, not ignored by the loader. Table 1-1 shows the languages
and the appropriate shared global command and syntax.
Table 1-1. Shared Global Commands or Syntax
-------------------------------------------------
| | |
| Language | Command |
| | |
-------------------------------------------------
| | |
| HP Pascal/iX | $GLOBAL$ |
| | $EXTERNAL$ |
| | Module variables |
| | |
-------------------------------------------------
| | |
| HP C/iX | globals |
| | |
-------------------------------------------------
| | |
| HP FORTRAN/iX | common |
| | |
-------------------------------------------------
| | |
| HP COBOL II/iX | EXTERNAL clause |
| | |
-------------------------------------------------
| | |
| HP RPG/iX | RLABL |
| | |
-------------------------------------------------
NOTE Shared global data as defined in this addendum means each process
will have its own copy of the data. This is not to be confused
with all processes sharing one copy of the data.
Each program file and executable library (XL) contains a Library Symbol
Table (LST) at the beginning of the file. Normally, during linking, the
Link Editor places unresolved references to code in an import list. With
shared global data, the Link Editor also places unresolved references to
data and data exports in the import list. At run time, the loader
resolves the symbols in the import list by searching the LST in the
program file and in one or more XLs. The loader builds an External
Reference Table (XRT) that tracks externally-called procedures and allows
them to be shared.
Additionally, the loader initializes a Data Cross Reference Table (DXRT)
with data definition addresses. The DXRT holds entries for all data
references that need a corresponding definition. This allows externally
referenced data to be tracked and shared.
Table 1-2 shows the data types and scopes that are inserted into the
Library Symbol Table.
Table 1-2. Library Symbol Table
--------------------------------------------------------------------------------------------
| | |
| Data Types | Scope |
| | |
--------------------------------------------------------------------------------------------
| | |
| Data Universal | An initialized data symbol defined in an object module that is |
| | visible (exportable) to other object modules. |
| | |
--------------------------------------------------------------------------------------------
| | |
| Data Unsat | A data symbol that is referenced by an object module but not |
| | defined in it. For shared global data, these symbols are now |
| | allowed in XLs and program files. |
| | |
--------------------------------------------------------------------------------------------
| | |
| Storage Universal | An uninitialized data symbol created when an uninitialized data |
| | declaration is made. Note that if no corresponding Data |
| | Universal is found for it during linking, the scope is changed |
| | from Unsat to Universal and the symbol is exportable and can now |
| | be used to satisfy references (imports). |
| | |
--------------------------------------------------------------------------------------------
LKSHAREDATA Variable
You can now set a job or session variable called LKSHAREDATA. If
LKSHAREDATA is set to TRUE, all subsequent linking is for shared code and
data. This is equivalent to linking with the ;SHARE option.
If LKSHAREDATA is not set or is set to FALSE, all subsequent linking is
for shared code only. If you want to share data, the ;SHARE option must
be specified on the link line.
CAUTION Setting this variable affects all linking done in the job or
session. There is no option to turn off sharing data during a
link if this variable is set to TRUE. If logon UDCs are used,
this variable can be set for each user, all users in an account,
or all users on the system.
MPE/iX 5.5 Documentation