8

The commands to compile and execute StrVar.p and StrVarmain.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:

The Pascal procedure, FixVec.p

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_ }

The FORTRAN main program, FixVecmain.f

integer Sum integer a(9)

data a / 1,2,3,4,5,6,7,8,9 / call FixVec ( a, Sum )

write( *, "( I3 )") Sum stop

end

The FORTRAN–Pascal Interface

171