The C–Pascal Interface
133
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
If the types are compatible, a global variable can be shared between C and
Pascal.
An example:
The Pascal procedure,
GloVar.p
var
Year: integer;
procedure GloVar;
begin
Year := 2001
end; { GloVar }
The C main program,
GloVarMain.c
#include <stdio.h>
extern void GloVar();
int Year;
int main(void)
{
Year = 2042;
GloVar();
printf( " %d \n", Year ) ;
}
Содержание SunSoft Pascal 4.0
Страница 14: ...xiv Pascal 4 0 User s Guide ...
Страница 16: ...xvi Pascal 4 0 User s Guide ...
Страница 30: ...6 Pascal 4 0 User s Guide 1 ...
Страница 160: ...136 Pascal 4 0 User s Guide 6 ...
Страница 268: ...244 Pascal 4 0 User s Guide 11 ...
Страница 320: ...296 Pascal 4 0 User s Guide B ...
Страница 331: ...Index 307 ...
Страница 333: ......