[fpc-devel] Console IO revisited

Sven Barth pascaldragon at googlemail.com
Fri Dec 3 16:10:57 CET 2010


Am 03.12.2010 13:22, schrieb Thaddy:
> 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.

Would you mind sharing some example Pascal code for what you're trying 
to do? Maybe you are just missing something (yes, I have read the other 
mails in this thread).

Regards,
Sven



More information about the fpc-devel mailing list