Re: POpen en PClose

Adriaan van Os via fpc-pascal <[email protected]> Mon, 20 Jul 2026 13:13:56 +0000 (UTC)
Newsgroups gmane.comp.compilers.free-pascal.general
Message-ID <[email protected]>

On 20/07/2026 11:40, Marco van de Voort via fpc-pascal wrote:
>
> Op 20-7-2026 om 10:13 schreef Adriaan van Os 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.

Ah, so that means that I couldn't just call naively into libc popen with 
FileRec.Handle ?

Regards,

Adriaan van Os

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal