The Pascal function,
RetReal.p
The C++ main program,
RetRealMain.cc
The commands to compile and
execute RetReal.p and
RetRealMain.cc
Simple Types
Simple types pass in a straightforward way, as in the following example:
function RetReal (r: real): real;
begin
RetReal := r + 1
end;
#include <stdio.h>
extern "C" double RetReal (double);
int main(void)
{
double
r, s;
r = 2.0;
s = RetReal (r);
printf (" %f \n", s);
}
hostname% pc -c RetReal.p
hostname% CC RetReal.o RetRealMain.cc -lpc
hostname% a.out
3.000000
The C++–Pascal Interface
7
153
Need help?
Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?
Questions and answers