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

  • 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 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
Zobrazit stránku 110
1 2 ... 106 107 108 109 110 111 112 113 114 115 116 ... 332 333

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

Žádné komentáře