The commands to compile and
execute StrVar.p and
StrVarmain.f
The Pascal procedure,
FixVec.p
The FORTRAN main program,
FixVecmain.f
hostname% pc -c StrVar.p
hostname% f77 StrVar.o StrVarmain.f -lpfc -lpc
StrVarmain.f:
MAIN:
hostname% a.out
s10='abcdefghij'
s80='abcdefghijklmnopqrtstuvwxyz
s25='oyvay'
Fixed Arrays
For a fixed array parameter, pass the same type and size by reference, as
shown in the following example:
type
VecTyp = array [0..8] of integer;
procedure fixvec_(var V: VecTyp; var Total: integer);
var
i: integer;
begin
Total := 0;
for i := 0 to 8 do
Total := Total + V[i]
end; { fixvec_ }
integer Sum
integer a(9)
data
a / 1,2,3,4,5,6,7,8,9 /
call FixVec ( a, Sum )
write( *, "( I3 )")
stop
end
The FORTRAN–Pascal Interface
Sum
8
171
Need help?
Do you have a question about the SunSoft Pascal 4.0 and is the answer not in the manual?
Questions and answers