![](/images/backgrounds/286549/hp-sunsoft-pascal-4-0-users-manual-549395184x1.png)
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
The commands to compile and execute RetReal.cc and 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.
hostname% CC
2.0 Return - 3.0
160 | Pascal 4.0 User’s Guide |