Pointers – HP SunSoft Pascal 4.0 User Manual
Page 224

200
Pascal 4.0 User’s Guide
8
Pointers
Pointers are easy to pass, as shown in the following example:
The FORTRAN subroutine,
PassPtr.f
. In the FORTRAN
subroutine, the name is
converted to lowercase.
Uppsercase is ignored.
subroutine PassPtr ( iPtr, dPtr )
integer i
double precision d
pointer ( iPtr, i ), ( dPtr, d )
i = 9
d = 9.9
return
end
The Pascal main program,
PassPtrmain.p
. In the
Pascal program, where it calls
the FORTRAN subroutine, the
name must be in lowercase.
program PassPtrmain;
type
PtrInt = ^ integer;
PtrReal = ^ real;
var
i: integer := 0;
r: real := 0.0;
iP: PtrInt;
rP: PtrReal;
procedure passptr(var xiP: PtrInt; var xrP: PtrReal);
external fortran;
begin
iP := addr(i);
rP := addr(r);
passptr(iP, rP);
writeln(i: 2, r: 4: 1)
end. { PassPtrmain }