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
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......