At 02:19 PM 8/7/97 +0200, Frank Heckenbach wrote:
Peter Gerwinski wrote:
In such situations, where the procedure/function does not change the parameter, you can declare it with a `PChar' parameter. GPC knows what to do if the user passes a String schema and implicitly passes the address of the string data instead of the address of the schema.
But it doesn't add a #0 terminator, so the result may be wrong, as in the following program:
program x; {$x+}
procedure p(x:pchar); begin writeln(x) end;
var x:string(10)='abc'; begin x:='x'; p(x) end.
If I use the built in conversion this would be a problem, but I plan on converting string to cstring using a little strings unit I wrote just for this purpose. Ncurses expects a real zero terminated string. You can get around that by coding `x := x + chr(0)' in Frank's example above but I want the ncurses usage to be seemless (more or less) with as little calling overhead as possible. No problems with that, now that I know how to use AsmName.
I will adopt the `foo' and 'cfoo' (where foo is pascal and cfoo is C) convention.
Thanks for the comments! Ken L.