Changeset 2274 for trunk


Ignore:
Timestamp:
Jan 25, 2013, 1:35:24 PM (7 years ago)
Author:
sam
Message:

build: provide weak symbols for lol_sdl_main on Visual Studio.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core.h

    r2273 r2274  
    7070
    7171/* If using SDL, let it override main() but immediately replace
    72  * the override with ours. */
     72 * the override with ours, then declare weak symbols to ensure one
     73 * of our dummy functions gets replaced by the user's main(). */
    7374#if defined USE_SDL
    7475#   include <SDL_main.h>
     
    7677#       undef main
    7778#       define main lol_sdl_main
     79#       if defined _MSC_VER
     80int lol_sdl_main();
     81int lol_sdl_main_msvc();
     82#pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHXZ" \
     83                                      "=?lol_sdl_main_msvc@@YAHXZ")
     84int lol_sdl_main(int argc, char **argv);
     85int 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")
     88int lol_sdl_main(int argc, char **argv, char **envp);
     89int 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
    7893#   endif
    7994#endif
  • trunk/src/platform/sdl/sdlapp.cpp

    r2273 r2274  
    4444#if defined main
    4545#   if defined _MSC_VER
    46 #       pragma comment(linker, "/alternatename:_lol_sdl_main=_lol_sdl_main_msvc")
     46int lol_sdl_main();
     47int lol_sdl_main(int argc, char **argv);
     48int lol_sdl_main(int argc, char **argv, char **envp);
    4749#       define WRAPPER lol_sdl_main_msvc
    4850#   else
     
    5456
    5557/* One of these wrappers will be overridden by the user's version */
     58
    5659int WRAPPER() { return 0; }
    5760int WRAPPER(int argc, char **argv) { return 0; }
     
    6063int main(int argc, char *argv[])
    6164{
    62 printf("LOL OK\n");
    6365    int ret = 0;
    6466    ret += lol_sdl_main();
  • trunk/test/testsuite.cpp

    r2183 r2274  
    2020#include <lol/unit.h>
    2121
    22 int main(int argc, char **argv)
     22int main()
    2323{
    2424    lol::TextTestRunner runner;
Note: See TracChangeset for help on using the changeset viewer.