[fpc-pascal] handing over array of pchars to C program
Marco van de Voort
marcov at stack.nl
Mon Sep 3 09:31:29 CEST 2007
> has anyone managed to build in a pascal program what in C is a
> char *strings
> and use it from C?
Same as char**strings so ppchar.
> In pascal terms this is a single dimensional array aka vector of PChar.
> Do I have to make copies of any string or is it sufficient to fill up an
> array with PChar?
That depends on what you do with it, like under C, where you can also let it
point to e.g. constants using &
> My attemtps all failed up to know ...
Have a look at the unixutil unit (most notably stringtoppchar) and the unix unit
implementation (exec procedures that use environment mostly)
Note that the unixutil unit was meant only as a temporary helper for unix,
and not really meant to be used by endusers. The "leftovers" of the
linux->unix unit transform are stored there.
More information about the fpc-pascal