[SDL] Getting rid of stdout redirect

Michael B. Edwin Rickert panda at industry.no-ip.com
Sat Jan 15 20:19:53 PST 2005

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.

 From what little I can find on the semantics of freopen (the method 
used to do the redirection) there's no general application level manner 
of undoing these redirects. I'd check the site/CVS for possible 
environment variables to override this (not sure if there are any) but 
libsdl.org appears down (Too many clients PostgreSQL error message ~_~) 
and I don't have the direct links on me, nor source.

More information about the SDL mailing list