[fpc-pascal] handing over array of pchars to C program

Marc Santhoff M.Santhoff at t-online.de
Tue Sep 11 17:07:54 CEST 2007

Am Montag, den 03.09.2007, 09:31 +0200 schrieb Marco van de Voort:
> > 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.

The missing link. :)

> > 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.

But at least it is a nice source of information for learning how to
handle some cases.


More information about the fpc-pascal mailing list