6

The commands to compile and execute RetReal.p and RetRealMain.c

hostname% pc -c RetReal.p

hostname% cc RetReal.o RetRealMain.c

hostname% a.out 3.000000

Input and Output

If your C main program calls a Pascal procedure that does I/O, then include the following code in the C main program before you call the Pascal procedure:

__PC0__PCSTART();

Also, in the C main program just before exit, add the following line:

__PC0__PCEXIT();

See this example:

The Pascal procedure, IO.p

The C main program, IOMain.c

procedure IO; begin

writeln('Hello Pascal and St. Petersburg!');

end;

#include <stdio.h>

extern void IO();

int main(void)

{

IO();

printf("Hello C! \n");

}

116

Pascal 4.0 User’s Guide

Page 140
Image 140
HP SunSoft Pascal 4.0 manual Input and Output, Commands to compile and execute RetReal.p and RetRealMain.c, 116