HP Pascal/iX Programmer's Guide (31502-90023)

2-: 6
and SEARCH, refer to the
HP Pascal/iX Reference Manual
or the
HP
Pascal/HP-UX Reference Manual
, depending on your implementation.
A program can define a module with the same name as a module in the
library that SEARCH specifies. In that case, the program imports the
module that it defines, rather than the library module with the same
name. If a library contains two modules with the same name, the second
one overrides the first. The compiler does not warn you when you are
about to override an existing module.
When a program imports a module, the module and its exported items
(including the module's exported modules) belong to the global scope of
the program. The items that the module does not export (those in its
implement part) also exist for the same lifetime as the exported items
that were compiled at the simultaneously, even though the program cannot
access them.
These non-exported items will not be put in the global symbol table if
each module is separately compiled.
NOTE An exception to this rule occurs if any INLINE routines are
exported. In this case all items in the
implement part
are placed
in the module-text and the symbol table when imported. This
includes any references to intrinsics, even those not used by the
INLINE routines. This also means that any $SYSINTR$ option used by
the imported module must also be present in the importing module or
program, along with the intrinsic file itself. Because of this,
you may want to create multiple smaller modules, one of which will
contain the inline routines, but without any intrinsics declared.
Example
Independently compiled modules (to be compiled together in a single
compilation unit):
MODULE Mod1; {Mod1 is in Mod1.o}
EXPORT
.
:
IMPLEMENT
.
:
END; {Mod1}
MODULE Mod2; {Mod2 is in Mod1.o}
IMPORT
Mod1; {Mod2 imports Mod1}
EXPORT
.
:
IMPLEMENT
.
:
END; {Mod2}
MODULE Mod3; {This Mod3 is in Mod1.o}
EXPORT
.
:
END. {Mod3}
Program (to be compiled as a compilation unit that does not contain the
above modules -- the program imports the modules from the above
compilation unit):
PROGRAM prog;