At present, SDL is only designed to support applications,
sdl-config gives switches like these:
[OSX]
$ sdl-config --cflags
-I/Users/rfistman/include/SDL -D_THREAD_SAFE
$sdl-config --libs
-L/Users/rfistman/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL
$ sdl-config --libs
-L/usr/local/lib -lmingw32 -lSDLmain -lSDL -mwindows -mno-cygwin
[nocygwin]
$ sdl-config --cflags
-I/usr/local/include/SDL -Dmain=SDL_main -I/usr/include/mingw -DWIN32
-Uunix -mno-cygwin
Similarly on other platforms. The idea, I guess, is to support
’an SDL application’.
The effect is that (officially) SDL can’t be embedded.
I would really like to see this fixed (officially).
In fact embedded SDL seems to work just fine on Linux,
and possibly on Windows – I have stuff that works
on both without needing SDLmain. I see in the source a lot
of the mainline init code has been moved into
SDL_init – where, IMHO, it should be if possible.
Most of the SDLmain seems to do nothing more than
fiddling argc/argv, which I have no need of.
However there is also some code, eg on Windows registering
a main Window class if I remember correctly.
I have no problem with supporting platform independent
application development, but I’d like to see embedded
code work too. In such an environment, it isn’t acceptable
for a foreign mainline to take over. In particular in
my system, the mainline is a pre-built binary executable
and all user code is put in a DLL which it loads and
runs.–
John Skaller
Felix, successor to C++: http://felix.sf.net