Should #include "SDL_main.h" be removed from supporting SDL header files? (was: Mainline vs Embedded)

Sort of on the topic of using SDL as just a library, I was wondering
if the #include “SDL_main.h” declarations should be removed from all
the SDL_*.h headers (SDL.h will continue to have it for compatibilty).
I remember that a collegue of mine was trying to use SDL_mixer in an
MFC based framework and he had no control over how WinMain() was
invoked. Including “SDL_mixer.h” included SDL_audio.h which included
SDL_main which caused him lots of grief. It wasn’t until much later we
hypothesized we could hide the inclusion of SDL_main.h to get around
this problem.

Currently, #include “SDL_main.h” resides in:
SDL_audio.h
SDL_mutex.h
SDL_thread.h
SDL_timer.h

Thanks,
Eric

Sort of on the topic of using SDL as just a library, I was wondering
if the #include “SDL_main.h” declarations should be removed from all
the SDL_*.h headers (SDL.h will continue to have it for compatibilty).

It’s a tough call. Some of the test programs only include the headers
they need, and assume that main() will be set up correctly for their
platform.

I remember that a collegue of mine was trying to use SDL_mixer in an
MFC based framework and he had no control over how WinMain() was
invoked. Including “SDL_mixer.h” included SDL_audio.h which included
SDL_main which caused him lots of grief.

What specifically did he have a problem with? If you don’t declare main()
in your program, including SDL_main.h should have no effect…

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment

Sort of on the topic of using SDL as just a library, I was wondering
if the #include “SDL_main.h” declarations should be removed from all
the SDL_*.h headers (SDL.h will continue to have it for compatibilty).

It’s a tough call. Some of the test programs only include the headers
they need, and assume that main() will be set up correctly for their
platform.

Can we just explicitly add #include “SDL_main.h” to the test programs?
It seems kind of strange that only those 4 public SDL headers have
that include (opposed to all of them or none of them). It also doesn’t
seem like they should really depend on SDL_main. (What does
SDL_audio.h have to do with main, and why does it have a specific
dependency on this, when say SDL_video.h does not?)

I remember that a collegue of mine was trying to use SDL_mixer in an
MFC based framework and he had no control over how WinMain() was
invoked. Including “SDL_mixer.h” included SDL_audio.h which included
SDL_main which caused him lots of grief.

What specifically did he have a problem with? If you don’t declare main()
in your program, including SDL_main.h should have no effect…

It’s been a long time (like a year or two ago) so he doesn’t remember
the specifics. He said he’ll try to recreate it. I think it had
something to do with the fact that the library he was using or MFC
controls the call to WinMain(), but SDL_main.h was trying to redefine
stuff to use the form int main(int,char[]*), and the compiler didn’t
like this.

Thanks,
Eric> Date: Fri, 24 Feb 2006 02:20:58 -0800

From: Sam Lantinga