HP SunSoft Pascal 4.0 Manual do Utilizador Página 111

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 333
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 110
Separate Compilation 87
5
Sharing Declarations in Multiple Units
Using extern and external directives for procedure and function
declarations, you can optionally specify the source language of a separately
compiled procedure or function. For example, extern fortran directs the
compiler to generate calling sequences compatible with the FORTRAN
compiler from SunSoft
. Then, external c directs the compiler to generate
calling sequences compatible with SunSoft C compiler.
The module unit, ext_mod.p module ext_mod;
define
global, proc;
%include "extern.h";
procedure proc;
begin
writeln('From PROC : ',global);
global := global + 1;
end; { proc }
Theinclude file, extern.h var
global : extern integer;
procedure proc; extern;
The commands to compile and
execute ext_prog.p and
ext_mod.p
hostname% pc -xl ext_prog.p ext_mod.p
ext_prog.p:
ext_mod.p:
Linking:
hostname% a.out
From MAIN, before PROC: 1
From PROC : 1
From MAIN, after PROC: 2
Vista de página 110
1 2 ... 106 107 108 109 110 111 112 113 114 115 116 ... 332 333

Comentários a estes Manuais

Sem comentários