[fpc-devel] Console IO revisited

Thaddy thaddy at thaddy.com
Fri Dec 3 13:47:21 CET 2010

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.

More information about the fpc-devel mailing list