The FORTRAN–Pascal Interface
201
8
Function Return Values
Function return values match types the same as with parameters, and they
pass in much the same way.
Simple Types
The simple types pass in a straightforward way, as in this example:
The commands to compile and
execute
PassPtr.f
and
PassPtrmain.p
hostname% f77 -c PassPtr.f
PassPtr.f:
passptr:
hostname% pc PassPtr.o PassPtrmain.p -lpfc -lF77
hostname% a.out
9 9.9
The FORTRAN function,
RetReal.f
double precision function retreal ( x )
retreal = x + 1.0
return
end
The Pascal main program,
RetRealmain.p
program retrealmain;
var
r, s: real;
function retreal(x: real): real; external fortran;
begin
r := 2.0;
s := retreal(r);
writeln(r: 4: 1, s: 4: 1)
end. { retrealmain }
Содержание 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: ......