[SDL] Re: Getting rid of stdout redirect

jimrandomh usenetNOSPAM at jimrandomh.org
Tue Jan 18 10:30:33 PST 2005


"Philip D. Bober" <wildfire1138 at mchsi.com> wrote:
> jimrandomh wrote:
>> By default, SDLmain redirects stdout and stderr to files. This is
>> a configure-time option in the static portion of the library. For
>> my program, this is blatantly wrong behavior and not acceptable
>> (dedicated server using SDL that's expected to be interactive on
>> stdin/stdout). Now, I can recompile SDL to not do this, but...
>> 
>> I can't really tell someone who downloads a source tarball that
>> they need to recompile SDL with a nonstandard option, and I
>> *certainly* can't make a configure check for it. My present
>> workaround is to compile SDL_win32_main.c directly into the
>> project with NO_STDIO_REDIRECT defined, but that's clearly an
>> ugly hack/bad idea. 
>> 
>> Is there any way to *cleanly* work around this? Better behavior
>> would be for SDL to wait until sdlInit is called, and provide an
>> option to control whether stdio should be redirected. Or best of
>> all, just drop the redirection thing entirely and provide a
>> library function for it. 
>> 
> Have you tried switching to a CONSOLE project? I believe that
> should shut off the redirection.

I'm not using Visual C, I'm using MinGW. And the MinGW equivalent of a 
console project (using main() as the insertion point) doesn't work if 
SDL is linked in. Besides, telling VC to use a console project has 
other side-effects (like spawning a console window even if you don't 
want one).

-- 
CalcRogue: TI-89, TI-92+, PalmOS, Windows and Linux.
http://calcrogue.jimrandomh.org/





More information about the SDL mailing list