[fpc-devel] Console IO revisited

Michael Van Canneyt michael at freepascal.org
Fri Dec 3 13:52:47 CET 2010



On Fri, 3 Dec 2010, Thaddy wrote:

> On 3-12-2010 13:38, Michael Van Canneyt wrote:
>> 
>> 
>> On Fri, 3 Dec 2010, Thaddy wrote:
>> 
>>> Sorry if this is already picked up as it IMHO should have been. I missed 
>>> some mails due to a server crash.
>>> 
>>> Today I encountered a similar issue with using threadvars for the input, 
>>> output and err variables in system when trying to use the input as a win32 
>>> sync handle with the CreateFile API. Fails miserably.
>>> This is specified in the windows API documentation, but is broken in FPC 
>>> because the IO are not global to a process but threadvar.
>> 
>> Would you care to explain this ?
>> 
>> The variables Input, Output and StdErr may be threadvars, but they share a 
>> single common OS handle. So any OS-specific functions should still work if 
>> you are using the handles.
> No they do not, see my previous post, hence my problem. Mind the words "even 
> if" in the win api doc cit.
> I may be * very * wrong, but it simply doesn't work as expected. Under Delphi 
> it works as expected and in line with the API documentation. I am 
> investigating Linux (Ubuntu and my own woof builds) to get a similar example 
> working without workarounds.

As said in my other mail:
The behaviour of Input, Output, StdErr is not governed by OS rules, but by the 
pascal standard.

Michael.



More information about the fpc-devel mailing list