Hello SDL Developpers,
First of all, I would like to thank you for your work on SDL. It is of great
help when it comes to write cross-plateform multimedia applications !
I’m posting today to expose a trouble we have with SDL to port ARAnyM (
http://aranym.sf.net - an ATARI 16/32 bits compatible virtual machine) to
This GPL software was originaly written on linux using SDL. When we tried to
port it to Windows we decided to use Cygwin, since (as opposed to MinGW) it
would avoid rewritting a lot of code. Unfortunatly, sdl-config script enforce a
MinGW compilation though the “-mno-cygwin” GCC flag.
We did not understand the reason of our problems at the beginning. The first
Windows compilation was done almost by error, when a developper compiled
without using sdl-config.
Currently, we use a script that hacks sdl-config to allow a real Cygwin
compilation by removing some flags with sed this way :
sed -f- -i.bak sdl-config << EOF
Full script is available at
As you can see, I had to remove “-Dmain=SDL_main”, as GCC could not link with
it. This means that, in our Windows binary, SDLmain::WinMain/console_main is
not called at startup, and can’t initialize SDL or parse command line. Still,
ARAnyM seems to run quite well.
Anyway, I would like to throw away this dirty hack.
The best way, IMHO, to do so would be to have an SDL that can link with a Cygwin
binary. I guess this means creating a new target OS for SDL. An SDL lib linked
with Cygwin would have the advantage to be able to interpret Cygwin paths
(like, say, “/usr/local/aranym/font8.bmp”). This would ease porting application
since Cygwin makes Windows more posix-like. This means that a SDL program that
compiles on linux has great chances to compile also on Cygwin without the work
needed to support native Windows environnment like with MinGW. Of course, this
can only be applied to GPL programs, unless user buy a commercial license of
Cygwin (see http://www.redhat.com/software/cygwin/ ).
Another way would be to stop using tricks like “-Dmain=SDL_main” in SDL. I guess
you did it this way to be assured that SDL is the first to parse command-line.
But I think there is a real drawbacks in this approach (appart from our
problem) : a program can not be linked with several libraries that use this
main redefinition. It may lead to a developper having to choose between SDL and
IMHO, this should be removed and it should be software author responsibility to
call a “SDL_ParseCommandLine(int argc, char **argv)” at the beginning of his
code. Of course this would be incompatible with current software. I think this
could be solved by letting the current scheme as default and by adding a new
autoconf macro that would pass an additionnal parameter to sdl-config, letting
it knows that it should not enforce the above flags.
Thanks a lot for reading. I’m looking forward for any comment/help.