[fpc-devel] Console IO revisited

Thaddy thaddy at thaddy.com
Fri Dec 3 13:22:41 CET 2010


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.

This is a mistake! (without due explanation, not from the point of FPC 
developers, but from the point of view of OS development

Checkout for example: 
http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx

It becomes obvious, especially in the case of (the recommended) 
overlapped IO for std streams that this is totally broken in FPC. Also, 
as I stated before, for the same reason it breaks the Posix compliance. 
AFAIK it also would break any GCC/C++ code for OS's that contain a Posix 
subsystem and you would want to translate some code for.

I therefore ask again  to change the Threadvars for console IO to vars.

It breaks not only what windows expects, but also what most nixes expect.

The only somewhat useful comments I have seen regarding to this in our 
previous discussion are FPC specific! work-arounds.



More information about the fpc-devel mailing list