[fpc-pascal] POpen en PClose

Michael Van Canneyt michael at freepascal.org
Mon Jul 20 12:07:34 CEST 2026



On Mon, 20 Jul 2026, Marco van de Voort via fpc-pascal wrote:

>
> Op 20-7-2026 om 11:57 schreef Michael Van Canneyt via fpc-pascal:
>>>>
>>>> I am looking at the implementation of POpen and PClose in the 
>>>> runtime-library for Darwin (or more general for UNIX). It seems like 
>>>> it doesn't call into libc popen and pclose, but instead follows its 
>>>> own implementation in unix.pp in POpen_internal. I am just curious 
>>>> to know the reason.
>>>>
>>> Phew, that was over twenty years ago, but afaik the reason is that 
>>> libc popen and pclose us C FILE descriptors, which the RTL in general 
>>> doesn't use to avoid a mix of functions with pascal and C file types.
>>>
>>> So popen/pclose are a more high level (FILE * using) part of libc, 
>>> while we tend to only use the basis.
>>
>> Glad our memories agree on this :-) 
>
> Well aside from the fact that FreeBSD was the architecture where the 
> baseunix/unix RTL  was done. The port to Linux was only done later :-)

Correct, but popen/pclose existed before that in the linux unit.
Pretty sure about that, because I implemented it there.

Michael.


More information about the fpc-pascal mailing list