On 2013-11-08 11:31, Václav Zeman wrote: > On 7 November 2013 22:00, Panicz Maciej Godek <godek.mac...@gmail.com > <mailto:godek.mac...@gmail.com>> wrote: > > Hi, > For some time I've been trying to compile my framework > for writing multimedia and 3d games in Guile Scheme > on Windows/MinGW. > The framework uses SDL library, and more details can be > found here: https://puszcza.gnu.org.ua/projects/slayer > > After many issues with compiling Guile Scheme on MinGW, > I've finally managed to achieve it, and having build SDL, > I proceeded to compile my framework. > > Although I did use the autotools to create a package, > I know only superficially how it is supposed to work. > Having ./configured my project, I managed to build the > object files, but the final linking (performed by libtool) > fails. It is invoked in the following way: > > ./libtool --tag=CXX --mode=link g++ -D_GNU_SOURCE=1 -Dmain=SDL_main > -Ic:/mingw/msys/1.0/include/SDL -Ic:/mingw/msys/1.0/include/guile/2.0 > -I/usr/local/include -Ic:/mingw/msys/1.0/include -Wall -Werror -mwindows > -Lc:/mingw/msys/1.0/lib -lmingw32 -lSDLmain -lSDL -Lc:/mingw/msys/1.0/lib > -lguile-2.0 -lgc -mwindows -Lc:/mingw/msys/1.0/lib -lSDL_image -lmingw32 > -lSDLmain -lSDL -g -O2 -mwindows -Lc:/mingw/msys/1.0/lib -lmingw32 > -lSDLmain -lSDL -Lc:/mingw/msys/1.0/lib -lguile-2.0 -lgc -mwindows > -Lc:/mingw/msys/1.0/lib -lSDL_image -lmingw32 -lSDLmain -lSDL -o > slayer.exe file.o font.o image.o input.o slayer.o symbols.o video.o > -lSDL_ttf > > and the following error appears: > c:/mingw/msys/1.0/lib/libmingw32.a(main.o): In function `main': > > e:\p\giaw\src\pkg\mingwrt-4.0.3-1-mingw32-src\bld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c:91: > undefined reference to `WinMain@16' > collect2.exe: error: ld returned 1 exit status > > The -mwindows switch says that your are compiling a Windows GUI application, > which implies WinMain() function. If you are not doing that, remove the > switch and (maybe) use -mconsole instead. See > http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Windows-Options.html > for explanations of the switches.
The SDL library, for some obscure reason, has its own special take on that and prescribes that you should keep using main() even if you are doing a GUI app. I think the SDLmain library contains the real WinMain@16 entry point and that entry point in turn calls the application main function. Or I should perhaps say SDL_main (see that -Dmain=SDL_main define above). Some part of this fragile SDL crap fails. I don't know what. Perhaps the SDL_main library was compiled to expect an ordinary main entry point instead of the GUI WinMain@16 version? Just to be clear, I'm not an SDL user. This is just my understanding of this. The above description might very well be flawed in some way, but SDL initialization is peculiar. Cheers, Peter _______________________________________________ https://lists.gnu.org/mailman/listinfo/libtool