The program unit,
pubvar_prog.p, which declares
global as public
The module unit, pubvar_mod.p,
which also declares global as
public
The commands to compile and
execute pubvar_prog.p and
pubvar_mod.p
program pubvar_prog;
public var
global: integer;
procedure proc;
external;
begin
global := 1;
writeln('From MAIN, before PROC: ', global);
proc;
writeln('From MAIN,
end. { pubvar_prog }
module pubvar_mod;
public var
global : integer;
procedure proc;
begin
writeln('From PROC
global := global + 1;
end; { proc }
hostname% pc -xl pubvar_prog.p pubvar_mod.p
pubvar_prog.p:
pubvar_mod.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 1
From MAIN, after PROC: 2
Separate Compilation
after PROC: ', global)
:',global);
5
81
Need help?
Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?
Questions and answers