| Summary: | "main" is defined in sdl_main when building a console application | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Erik Faye-Lund <kusma> |
| Component: | main | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED WONTFIX | QA Contact: | Sam Lantinga <slouken> |
| Severity: | trivial | ||
| Priority: | P2 | ||
| Version: | HG 1.2 | ||
| Hardware: | x86 | ||
| OS: | Windows (All) | ||
|
Description
Erik Faye-Lund
2006-09-11 15:36:03 UTC
The whole reason main is defined to SDL_main is to have SDL applictions link with SDLmain.lib on Win32 by default. You're welcome to redefine it however you want for your application, of course. I don't see why you want anyone to link to SDLmain.lib in the first place. The problem with win32-programs using WinMain instead of main as the entry-point is a build-configuration thing much more than anything else, and that can be fixed with the change i proposed. It seems to me that you haven't really looked at the proposed change and/or realized the problems SDLmain.lib cause. One example of such an issue is that SDLmain.lib does not work with Visual Studio 2005 (due to linking to the wrong CRT - in the latest pre-built release at least), making hack-free (ie non-macro-hell) cross-platform programs using vs2k5 and sdl very tricky to set up. SDL.lib does not seem to have the issue of depending on the wrong CRT. The real reason I recommend that people link with it is so that DirectInput works. The SDL_SetModuleHandle(GetModuleHandle(NULL)) call needs to be made from the main application code, otherwise DirectInput fails to initialize on several versions of Windows. There's a reason why the binary packages are compiler specific - the C library linking issue is one of them. You are of course free to change it however you like, which is why SDL_win32_main.c is in the public domain. SDL 1.3 eliminates the need for SDLmain.lib entirely, simply by not using DirectInput (for the moment) |