program pascalcallsC(input,output); procedure world; external name 'c_world'; procedure w1(var i : integer; s : pchar); external name 'c_w1'; var i : integer; s : pchar; begin writeln("Hello world from Pascal"); world; writeln("Returned from C to Pascal\n"); i := 96; getmem (s, 260); { ahem - we need to allocate memory } w1(i,s); writeln("Returned from C again I = ",i); writeln("Return from C cstring = ",s); freemem (s, 260); { free this here, else memory leak on next line } s := "This is a CString"; { not really a good idea, IMHO } writeln("Trying out pascal ",s); end.