Ap D. Using HP Link Editor/XL with HP Pascal/XL [ HP Link Editor/XL Reference Manual ] MPE/iX 5.0 Documentation
HP Link Editor/XL Reference Manual
Appendix D Using HP Link Editor/XL with HP Pascal/XL
This appendix discusses the HP Pascal/XL compiler conventions that relate
specifically to HP Link Editor/XL. The following items explain how you
use these conventions to successfully create executable program files.
(For details about the compiler conventions shown, see the HP Pascal
Programmer's Guide.)
* Compilation units
If you do not use the $RLFILE compiler option, the entire source
file is treated as one compilation unit and the compiler produces
a relocatable object file containing a single relocatable object
module.
If you use $RLFILE, each PASCAL MODULE or non-nested procedure is
a separate compilation unit and results in a separate relocatable
object module in the relocatable library.
* Relocatable object module name
If you do not use the $RLFILE compiler option, the relocatable
object module name is the unqualified name of the Pascal source
file.
If you use $RLFILE, the relocatable object module name is the name
of the corresponding non-nested procedure or module in the source
file.
* Program entry point
The first executable statement in the outer block is the program
entry point. The outer block's name is PROGRAM.
* Scope of variables, functions and procedures
Outer block variables (declared with the GLOBAL compiler option)
and all modules and level one procedures and functions, have
universal scope.
The SUBPROGRAM option lets you compile a subset of level one
procedures or functions. It also lets you select parts of a large
program for compilation. Because each compilation creates a new
relocatable object module, you can't recompile into an existing
file and retain the old code. The SUBPROGRAM option is similar to
the EXTERNAL option in that the outer block is not compiled.
Variables can be coupled with an outer block that is compiled with
the GLOBAL option.
The EXTERNAL option can be used with the GLOBAL option to compile
procedures and functions separately. When EXTERNAL appears in a
source file, the compiler generates information about global
variables. This allows them to be coupled with identical
variables in an outer block that are compiled with the GLOBAL
option. The compiler generates object code only for procedures
and functions; not for the statement part of the outer block.
Routines in an executable library cannot reference program
globals. This includes INPUT and OUTPUT.
The GLOBAL compiler option prepares information about all global
variables declared in the outer block. It allows the variables to
be coupled with identical variables that are compiled with the
EXTERNAL option. The compiler generates object code for the outer
block, as well as for all procedures and functions.
* Locality sets
The LOCALITY option lets you assign the relocatable object to a
new or existing locality set. If you enter a name of an existing
locality set, the relocatable object code is placed into that set.
If the locality set does not exist, a new locality set is created
using that name.
The LOCALITY option remains in effect until a new one is
encountered. The LOCALITY option can appear anywhere in the
source program. However, the object code for an entire procedure
is placed into the last locality set used. You cannot place part
of a procedure in a locality set.
If you do not enter the LOCALITY option, CODE is the default
locality set name.
* Type checking
Two compiler options specify the level of type checking that the
link editor uses when resolving references between Pascal
procedures and functions. They are $CHECK_FORMAL_PARM integer$
and $CHECK_ACTUAL_PARM integer$ and they are described in the next
two paragraphs.
CHECK_FORMAL_PARM associates a check level with the formal
declaration of the procedure or function. Place CHECK_FORMAL_PARM
before the declaration of the procedure or function (it applies
only to the procedure or function immediately following it). If
you do not use CHECK_FORMAL_PARM, the compiler uses type checking
level 3.
CHECK_ACTUAL_PARM associates a check level with each procedure or
function call encountered. You can place CHECK_ACTUAL_PARM
anywhere in the source file. It remains in effect until a new
directive is encountered. If you do not use CHECK_ACTUAL_PARM,
the compiler uses type checking level 3.
To override the type checking level used during compilation, use
the PARMCHECK option of the LINK command (see Chapter 4).
MPE/iX 5.0 Documentation