HP SunSoft Pascal 4.0 Manuale Utente Pagina 177

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 333
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 176
The C++–Pascal Interface 153
7
Simple Types
Simple types pass in a straightforward way, as in the following example:
The Pascal function,
RetReal.p
function RetReal (r: real): real;
begin
RetReal := r + 1
end;
The C++ main program,
RetRealMain.cc
#include <stdio.h>
extern "C" double RetReal (double);
int main(void)
{
double r, s;
r = 2.0;
s = RetReal (r);
printf (" %f \n", s);
}
The commands to compile and
execute RetReal.p and
RetRealMain.cc
hostname% pc -c RetReal.p
hostname% CC RetReal.o RetRealMain.cc -lpc
hostname% a.out
3.000000
Vedere la pagina 176
1 2 ... 172 173 174 175 176 177 178 179 180 181 182 ... 332 333

Commenti su questo manuale

Nessun commento