68
Pascal 4.0 User’s Guide
4
The actual
includefile
looks like this:
In this example, the
include
file contains the entire program. In reality, an
include
file probably contains a set of variable or procedure declarations.
include
files are often used when a set of declarations needs to be shared
among a number of programs.
However, suppose your program is very large and takes a long time to
compile. Using
include
files may make editing more convenient, but when
you make a change in one part of your program, you still must recompile the
entire program. As another example, suppose you want to be able to share
compiled code with other people, but for reasons of security or convenience,
do not want to share the source code.
Both of these problems are solved by separately compiled units, generally
called units. A unit is a part of a program stored in its own file and linked
with the rest of the program after compilation.
Using Program Units and Module Units
There are two kinds of units:
•
Program unit
—This unit looks like any program. It begins with a program
header and contains the main program.
Here is an example:
begin
writeln ('Hello, world.')
end.
program program_unit (output);
procedure say_hello; extern;
begin
say_hello
end.
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......