From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPwce-0001LS-7X for qemu-devel@nongnu.org; Thu, 13 Aug 2015 13:49:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZPwca-0005Vk-VN for qemu-devel@nongnu.org; Thu, 13 Aug 2015 13:49:00 -0400 Received: from v220110690675601.yourvserver.net ([37.221.199.173]:37436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZPwca-0005VZ-Q3 for qemu-devel@nongnu.org; Thu, 13 Aug 2015 13:48:56 -0400 Message-ID: <55CCD87F.2020400@weilnetz.de> Date: Thu, 13 Aug 2015 19:48:47 +0200 From: Stefan Weil MIME-Version: 1.0 References: <20150813120643.GF430@redhat.com> In-Reply-To: <20150813120643.GF430@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Win32 stdio not working if SDL is enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Am 13.08.2015 um 14:06 schrieb Daniel P. Berrange: > When debugging some patches on Windows, I discovered that nothing printed > to stderr ever appears on the console. Eventually I discovered that if I > build with --disable-sdl, then stderr appears just fine. > > Looking at the code in vl.c I see a hack for SDL introduced in > > commit 59a36a2f6728081050afc6ec97d0018467999f79 > Author: Stefan Weil > Date: Thu Jun 18 20:11:03 2009 +0200 > > Win32: Fix compilation with SDL. > > > If I mostly kill the hack from vl.c, and just leave a plain '#undef main' > then I get working console stderr once again. > Hi Daniel, that's a feature of SDL 1.2: stdout and stderr are by default redirected to files stdout.txt and stderr.txt in the executable's directory. This redirection can be disabled by an environment variable (SDL_STDIO_REDIRECT="no"). On my Linux machines, I always set this variable, so when I run QEMU for Windows with wine32 or wine64, stdout and stderr work. Printing to stdout / stderr on Windows can be an adventure: depending on your shell (command.exe, cmd.exe, MinGW shell, MinGW rxvt, Cygwin shell, ...) it works different, and I also had application crashes when a GUI application which was not started from a shell tried to print to stdout. >>From a user's point of view, maybe a better solution than the current one would be a GTK console window which displays any output to stdout / stderr. Regards Stefan