Separate compilation, Working with units – HP SunSoft Pascal 4.0 User Manual

Page 99

Advertising
background image

75

Separate Compilation

5

This chapter describes how to compile Pascal programs in separate units.
Chapter 4, “Program Construction and Management,” gives an introduction to
the concepts in this chapter. Following are the sections:

In separate compilation, a program is divided into several units that can be
separately compiled into object (

.o

) files. The object files are then linked using

pc

, which invokes

pc3

to check for the consistent use of global names and

declarations across the different units, and then invokes

ld

(1) to link and load

the units. You can also give

pc

the names of all the units at once, in which case

pc

compiles all the units, checks for consistency, and links the units in one

step.

Separate compilation is different from independent compilation. In
independent compilation, you invoke

ld

directly, so there is no consistency

checking. Independent compilation is not addressed in this guide.

Working with Units

Pascal provides two types of source files or units: the program unit and the
module unit.

Working with Units

page 75

Sharing Variables and Routines Across Multiple Units

page 76

Sharing Declarations in Multiple Units

page 87

Advertising