HP SunSoft Pascal 4.0 Manual do Utilizador Página 102

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 333
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 101
78 Pascal 4.0 Users Guide
5
Using extern Option to Share Routines
If a program or module calls a procedure not defined in that unit, you must
declare it with either the extern or external routine option. For instance, in
the previous example, the procedure proc is defined in shrvar_mod.p, but
used in shrvar_prog.p. Thus, it is declared as external in
shrvar_prog.p. Also, proc must also be defined as public in
shrvar_mod.p, which is the default.
Usinginclude Files to Share Variables and Routines
The include file contains the declarations for the program. Placing all
program declarations in a single file makes your program more consistent and
easier to maintain.
To use this feature, place the number sign character (#) in the first position of a
line immediately followed by the word include, and then a file name
enclosed in angle brackets (< and >) or double quotation marks ("). The
different enclosures (<> and "") affect the search order for files. The syntax for
the #include directive is determined by cpp(1).
When the compiler encounters the #include in the input, it inserts the lines
from the included file into the input stream.
The commands to compile and
execute shrvar_prog.p and
shrvar_mod.p
hostname% pc shrvar_prog.p shrvar_mod.p
shrvar_prog.p:
shrvar_mod.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 1
From MAIN, after PROC : 2
Vista de página 101
1 2 ... 97 98 99 100 101 102 103 104 105 106 107 ... 332 333

Comentários a estes Manuais

Sem comentários