HP SunSoft Pascal 4.0 Uživatelský manuál Strana 108

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 333
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 107
84 Pascal 4.0 Users Guide
5
Using include Files
In the following example, the extern declaration for the variable global is in
the include file, inc_prog2.p, and is therefore included in both files. The
define declaration in file inc_mod2.p cancels the extern definition.
The module unit,
defvar_mod2.p, which defines
global in a define declaration
module defvar_mod2;
var
global : extern integer;
define
global;
procedure proc;
begin
writeln('From PROC : ',global);
global := global + 1;
end; { proc }
The commands to compile and
execute defvar_prog.p and
defvar_mod2.p
hostname% pc -xl defvar_prog.p defvar_mod2.p
defvar_prog.p:
defvar_mod2.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 1
From MAIN, after PROC : 2
Zobrazit stránku 107
1 2 ... 103 104 105 106 107 108 109 110 111 112 113 ... 332 333

Komentáře k této Příručce

Žádné komentáře