Re: STDOUT_FILENO and STDERR_FILENO



John Emmas schreef op ma 20-05-2013 om 11:53 [+0100]:
On 19/05/2013 12:23, John Emmas wrote:
Just updated from Git and tried to build libglib using MSVC.  The 
build fails because a couple of files are now referencing 
'STDOUT_FILENO' and/or 'STDERR_FILENO'.  From the (admittedly, 
limited) research I did, it seemed as if they're only relevant for 
*nix, bash and Wine.  Here are the affected source files in case 
someone wants to check them:-

        glib/gtestutils.c
        gio/tests/filter-cat.c
        gio/tests/gdbus-eavmple-server.c


I've attached a couple of sample patches, either of which should fix the 
problem for 'glib/gtestutils.c'.  I'm not sure which of them would be 
considered as more preferable..?

One minor thing to take into account is that stdout and stderr are not
always file descriptors 1 and 2 on Windows environments. 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.

See also this bugreport which I filed some time ago (with patch)
regarding g_log on Win32:
https://bugzilla.gnome.org/show_bug.cgi?id=692085

Regards,

Erik van Pienbroek
Fedora MinGW SIG




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