On 20/05/2013 13:45, Erik van Pienbroek wrote:

When an executable is built with '-mwindows' (instead of '-mconsole') then
there is no stdout/stderr by default. To get a stdout/stderr one has to use
the win32 API functions AttachConsole and freopen which in turn will
return different file descriptors than 1 and 2.

That's interesting. I've often used AttachConsole and freopen myself but it never occurred to me to check whether the file descriptors were still 1 and 2.

So this probably means that my sample called "gtestutils.c.alternative-2.patch" is the safest one to choose, since it doesn't make any assumptions about the file descriptor values. Also (in theory) it should only attempt to write to the console if stdout / stderr appears to be valid (hopefully Windows would set them to NULL if they weren't valid?).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]