HP SunSoft Pascal 4.0 Manuale Utente Pagina 110

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 109
86 Pascal 4.0 Users Guide
5
Using extern
In the previous example, the extern definition for variables is put into an
include file and then shared. You can do the same for the extern procedure
definition. In doing so, you must also declare the variable with a define
declaration in the module that defines the procedure. This declaration nullifies
the effect of the extern declaration.
The commands to compile and
execute inc_prog2.p and
inc_mod2.p
hostname% pc -xl inc_prog2.p inc_mod2.p
inc_prog2.p:
inc_mod2.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 1
From MAIN, after PROC : 2
The program unit, ext_prog.p program ext_prog;
%include "extern.h";
begin
global := 1;
writeln('From MAIN, before PROC: ',global);
proc;
writeln('From MAIN, after PROC: ',global);
end. { ext_prog }
Vedere la pagina 109
1 2 ... 105 106 107 108 109 110 111 112 113 114 115 ... 332 333

Commenti su questo manuale

Nessun commento