[SDL] SDL and main

Olivier Delannoy olivier.delannoy at gmail.com
Thu Nov 23 08:37:07 PST 2006


SDLmain provide a single and identical entry point in your program
(the main you provide) which can be something else on some other
platform (WinMain on win32 for example) -lSDLmain and SDLmain.h allow
you to use main on all platforms.

On 11/23/06, Kostas Kostiadis <kos at climaxgroup.com> wrote:
> Hello all,
>
> In the past, on smaller projects, I used to do the following:
>
> #include <SDL/SDL.h> // which in turn includes SDLmain.h
>
> #ifdef __cplusplus
> extern "C"
> {
> #endif
>
> int main(int argc, char **argv)
> {
>         // blah
> }
>
> #ifdef __cplusplus
> extern "C"
> }
> #endif
>
>
> However, I now have a slightly larger project that has a bunch of libs (and
> a main of course).
> The libs that need SDL have the necessary includes, but my main is just
>
> int main(int argc, char **argv)
> {
>         // blah
> }
>
>
> without any of the SDLmain.h and extern "C" stuff.
> Everything seems to be compiling and linking ok...Is SDLmain.h something I
> always have to include with my
>         int main(int argc, char **argv)
>
> What happens if I don't?
>
> Cheers,
> Kos.
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl
>


-- 
Olivier Delannoy
ATER
PRiSM Laboratory
Versailles University, FRANCE




More information about the SDL mailing list