8

The following example illustrates this method:

The Pascal program, sun.pas

The FORTRAN subroutine, mygrout.f

The commands to compile and run this program

program Test(input,output); var

s : string;

procedure mygrout_(var prompt :string; length :integer32); external;

begin writeln('Starting...'); s := 'Trio Jeepy'; mygrout_(s, 8); writeln('Ending...')

end.

subroutine MyGrout(N) character*(*)N write(6,*) N

return end

hostname% pc -g -c sun.pas

hostname% f77 -g sun.o mygrout.f -lpc mygrout.f:

mygrout:

hostname% a.out

Starting...

Trio Jee

Ending...

190

Pascal 4.0 User’s Guide