![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395107x1.png)
5
The commands to compile and execute defvar_prog.p and defvar_mod.p
hostname% pc
defvar_mod.p: Linking: hostname% a.out
From MAIN, before PROC: 1
From PROC: 1
From MAIN, after PROC : 2
| Using the define Declaration |
| This example defines global in the module defvar_mod2 using the define |
| declaration. The advantage of using the define declaration over the define |
| variable attribute is that the define declaration can be easily converted to use |
| include files. |
The program unit, |
|
program defvar_prog; | |
defvar_prog.p |
|
| var |
| global: extern integer; |
| procedure proc; |
| external; |
| begin |
| global := 1; |
| writeln('From MAIN, before PROC: ', global); |
| proc; |
| writeln('From MAIN, after PROC: ', global) |
| end. { defvar_prog } |
|
|
Separate Compilation | 83 |