Changeset 2276 for trunk/src


Ignore:
Timestamp:
Jan 25, 2013, 2:38:46 PM (8 years ago)
Author:
sam
Message:

build: revert the weak symbol work; it confuses Visual Studio too much.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core.h

    r2274 r2276  
    6969#endif
    7070
    71 /* If using SDL, let it override main() but immediately replace
    72  * the override with ours, then declare weak symbols to ensure one
    73  * of our dummy functions gets replaced by the user's main(). */
    74 #if defined USE_SDL
     71/* If using SDL on Windows or OS X, let it override main() */
     72#if defined USE_SDL && (defined _WIN32 || defined __APPLE__)
    7573#   include <SDL_main.h>
    76 #   if defined main && !LOL_DONT_DIVERT_MAIN
    77 #       undef main
    78 #       define main lol_sdl_main
    79 #       if defined _MSC_VER
    80 int lol_sdl_main();
    81 int lol_sdl_main_msvc();
    82 #pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHXZ" \
    83                                       "=?lol_sdl_main_msvc@@YAHXZ")
    84 int lol_sdl_main(int argc, char **argv);
    85 int lol_sdl_main_msvc(int argc, char **argv);
    86 #pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHHPEAPEAD@Z" \
    87                                       "=?lol_sdl_main_msvc@@YAHHPEAPEAD@Z")
    88 int lol_sdl_main(int argc, char **argv, char **envp);
    89 int lol_sdl_main_msvc(int argc, char **argv, char **envp);
    90 #pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHHPEAPEAD0@Z" \
    91                                       "=?lol_sdl_main_msvc@@YAHHPEAPEAD0@Z")
    92 #       endif
    93 #   endif
    9474#endif
    9575
  • trunk/src/platform/sdl/sdlapp.cpp

    r2274 r2276  
    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
    1814
    1915#if defined USE_SDL
     
    4036HWND g_hwnd = NULL;
    4137extern IDirect3DDevice9 *g_d3ddevice;
    42 #endif
    43 
    44 #if defined main
    45 #   if defined _MSC_VER
    46 int lol_sdl_main();
    47 int lol_sdl_main(int argc, char **argv);
    48 int lol_sdl_main(int argc, char **argv, char **envp);
    49 #       define WRAPPER lol_sdl_main_msvc
    50 #   else
    51 int lol_sdl_main() __attribute__((weak));
    52 int lol_sdl_main(int argc, char **argv) __attribute__((weak));
    53 int lol_sdl_main(int argc, char **argv, char **envp) __attribute__((weak));
    54 #       define WRAPPER lol_sdl_main
    55 #   endif
    56 
    57 /* One of these wrappers will be overridden by the user's version */
    58 
    59 int WRAPPER() { return 0; }
    60 int WRAPPER(int argc, char **argv) { return 0; }
    61 int WRAPPER(int argc, char **argv, char **envp) { return 0; }
    62 
    63 int main(int argc, char *argv[])
    64 {
    65     int ret = 0;
    66     ret += lol_sdl_main();
    67     ret += lol_sdl_main(argc, argv);
    68     ret += lol_sdl_main(argc, argv, NULL);
    69     return ret;
    70 }
    7138#endif
    7239
Note: See TracChangeset for help on using the changeset viewer.