The FORTRAN–Pascal Interface
185
8
Simple Types
The simple types pass in a straightforward way, as follows:
Type
shortreal
There is no problem with returning a
shortreal
function value between
Pascal and FORTRAN. As in the previous example, it can be passed exactly,
with the Pascal
shortreal
type matching the FORTRAN
real
type (without
-xl
).
Procedure Calls: Pascal-FORTRAN
This section parallels “Procedure Calls: FORTRAN-Pascal” on page 168. The
comments and restrictions given in that section apply here, also.
The Pascal function,
RetReal.p
function retreal_(var x: real): real;
begin
retreal_ := x + 1
end; { retreal_ }
The FORTRAN main program,
RetRealmain.f
double precision r, s, RetReal
r = 2.0
s = RetReal( r )
write( *, "(2f4.1)") r, s
stop
end
The commands to compile and
execute
RetReal.p
and
RetRealmain.f
without –
xl
hostname% pc -c RetReal.p
hostname% f77 RetReal.o RetRealmain.f -lpfc -lpc
RetRealmain.f:
MAIN:
hostname% a.out
2.0 3.0
Summary of Contents for SunSoft Pascal 4.0
Page 14: ...xiv Pascal 4 0 User s Guide ...
Page 16: ...xvi Pascal 4 0 User s Guide ...
Page 30: ...6 Pascal 4 0 User s Guide 1 ...
Page 160: ...136 Pascal 4 0 User s Guide 6 ...
Page 268: ...244 Pascal 4 0 User s Guide 11 ...
Page 320: ...296 Pascal 4 0 User s Guide B ...
Page 331: ...Index 307 ...
Page 333: ......