Ignore:
Timestamp:
Jan 25, 2013, 12:38:58 PM (9 years ago)
Author:
sam
Message:

build: use our own main() wrapper in addition to SDL's, and only
in that case. Currently only works with GCC.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/platform/sdl/sdlapp.cpp

    r2222 r2273  
    1212#   include "config.h"
    1313#endif
     14
     15/* This instructs our headers to let SDL override the "main"
     16 * symbol using its macros. */
     17#define LOL_DONT_DIVERT_MAIN 1
    1418
    1519#if defined USE_SDL
     
    3640HWND g_hwnd = NULL;
    3741extern IDirect3DDevice9 *g_d3ddevice;
     42#endif
     43
     44#if defined main
     45#   if defined _MSC_VER
     46#       pragma comment(linker, "/alternatename:_lol_sdl_main=_lol_sdl_main_msvc")
     47#       define WRAPPER lol_sdl_main_msvc
     48#   else
     49int lol_sdl_main() __attribute__((weak));
     50int lol_sdl_main(int argc, char **argv) __attribute__((weak));
     51int lol_sdl_main(int argc, char **argv, char **envp) __attribute__((weak));
     52#       define WRAPPER lol_sdl_main
     53#   endif
     54
     55/* One of these wrappers will be overridden by the user's version */
     56int WRAPPER() { return 0; }
     57int WRAPPER(int argc, char **argv) { return 0; }
     58int WRAPPER(int argc, char **argv, char **envp) { return 0; }
     59
     60int main(int argc, char *argv[])
     61{
     62printf("LOL OK\n");
     63    int ret = 0;
     64    ret += lol_sdl_main();
     65    ret += lol_sdl_main(argc, argv);
     66    ret += lol_sdl_main(argc, argv, NULL);
     67    return ret;
     68}
    3869#endif
    3970
Note: See TracChangeset for help on using the changeset viewer.