Separate Compilation
83
5
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 commands to compile and
execute
defvar_prog.p
and
defvar_mod.p
hostname% pc -xl defvar_prog.p defvar_mod.p
defvar_prog.p:
defvar_mod.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 1
From MAIN, after PROC : 2
The program unit,
defvar_prog.p
program defvar_prog;
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 }
Содержание 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: ......