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

  • 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 183
160 Pascal 4.0 Users Guide
7
The following example shows how to pass simple types:
The C++ function, RetReal.cc extern "C"
double RetReal (double &x)
{
return (x + 1.0);
}
The Pascal main program,
RetRealMain.p
program RetRealMain (output);
var
r, s: real;
function RetReal (var x: real): real; external C;
begin
r := 2.0;
s := RetReal (r);
writeln ( r: 4: 1,' Return - ', s: 4: 1);
end.
The commands to compile and
execute RetReal.cc and
RetRealMain.p
hostname% CC -c RetReal.cc
hostname% pc RetReal.o RetRealMain.p
hostname% a.out
2.0 Return - 3.0
Zobrazit stránku 183
1 2 ... 179 180 181 182 183 184 185 186 187 188 189 ... 332 333

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

Žádné komentáře