6

functions can be passed to other languages as arguments, the static links for all procedure or function arguments are placed after the end of the conformant array bounds pairs, if any.

Routines in other languages can be passed to Pascal; a dummy argument must be passed in the position normally occupied by the passed routine’s static link. If the passed routine is not a Pascal routine, the argument is used only as a placeholder.

Global Variables in C and Pascal

The Pascal procedure, GloVar.p

The C main program, GloVarMain.c

If the types are compatible, a global variable can be shared between C and Pascal.

An example:

var

Year: integer;

procedure GloVar; begin

Year := 2001 end; { GloVar }

#include <stdio.h>

extern void GloVar();

int Year;

int main(void)

{

Year = 2042; GloVar();

printf( " %d \n", Year ) ;

}

The C–Pascal Interface

133