Browse Source

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

legacy
Sam Hocevar sam 12 years ago
parent
commit
39cd7a1fd0
5 changed files with 5 additions and 59 deletions
  1. +1
    -2
      configure.ac
  2. +2
    -22
      src/core.h
  3. +0
    -33
      src/platform/sdl/sdlapp.cpp
  4. +1
    -1
      test/math/Makefile.am
  5. +1
    -1
      test/testsuite.cpp

+ 1
- 2
configure.ac View File

@@ -197,8 +197,7 @@ AC_MSG_CHECKING(for -mwindows -mwin32)
AC_TRY_LINK([], [],
[AC_MSG_RESULT(yes)
CXXFLAGS="${CXXFLAGS} -mwindows -mwin32"
dnl If we come across these symbols, try to link them
LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16 -u_SDL_main"],
LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"],
[AC_MSG_RESULT(no)])
LIBS="$LIBS_save"



+ 2
- 22
src/core.h View File

@@ -68,29 +68,9 @@ static inline int isnan(float f)
# define main lol_android_main
#endif

/* If using SDL, let it override main() but immediately replace
* the override with ours, then declare weak symbols to ensure one
* of our dummy functions gets replaced by the user's main(). */
#if defined USE_SDL
/* If using SDL on Windows or OS X, let it override main() */
#if defined USE_SDL && (defined _WIN32 || defined __APPLE__)
# include <SDL_main.h>
# if defined main && !LOL_DONT_DIVERT_MAIN
# undef main
# define main lol_sdl_main
# if defined _MSC_VER
int lol_sdl_main();
int lol_sdl_main_msvc();
#pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHXZ" \
"=?lol_sdl_main_msvc@@YAHXZ")
int lol_sdl_main(int argc, char **argv);
int lol_sdl_main_msvc(int argc, char **argv);
#pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHHPEAPEAD@Z" \
"=?lol_sdl_main_msvc@@YAHHPEAPEAD@Z")
int lol_sdl_main(int argc, char **argv, char **envp);
int lol_sdl_main_msvc(int argc, char **argv, char **envp);
#pragma comment(linker, "/alternatename:?lol_sdl_main@@YAHHPEAPEAD0@Z" \
"=?lol_sdl_main_msvc@@YAHHPEAPEAD0@Z")
# endif
# endif
#endif

// Base types


+ 0
- 33
src/platform/sdl/sdlapp.cpp View File

@@ -12,10 +12,6 @@
# include "config.h"
#endif

/* This instructs our headers to let SDL override the "main"
* symbol using its macros. */
#define LOL_DONT_DIVERT_MAIN 1

#if defined USE_SDL
# if defined HAVE_SDL_SDL_H
# include <SDL/SDL.h>
@@ -41,35 +37,6 @@ HWND g_hwnd = NULL;
extern IDirect3DDevice9 *g_d3ddevice;
#endif

#if defined main
# if defined _MSC_VER
int lol_sdl_main();
int lol_sdl_main(int argc, char **argv);
int lol_sdl_main(int argc, char **argv, char **envp);
# define WRAPPER lol_sdl_main_msvc
# else
int lol_sdl_main() __attribute__((weak));
int lol_sdl_main(int argc, char **argv) __attribute__((weak));
int lol_sdl_main(int argc, char **argv, char **envp) __attribute__((weak));
# define WRAPPER lol_sdl_main
# endif

/* One of these wrappers will be overridden by the user's version */

int WRAPPER() { return 0; }
int WRAPPER(int argc, char **argv) { return 0; }
int WRAPPER(int argc, char **argv, char **envp) { return 0; }

int main(int argc, char *argv[])
{
int ret = 0;
ret += lol_sdl_main();
ret += lol_sdl_main(argc, argv);
ret += lol_sdl_main(argc, argv, NULL);
return ret;
}
#endif

namespace lol
{



+ 1
- 1
test/math/Makefile.am View File

@@ -9,7 +9,7 @@ noinst_PROGRAMS = pi poly remez

pi_SOURCES = pi.cpp
pi_CPPFLAGS = @LOL_CFLAGS@
pi_LDFLAGS = -u_SDL_main -uSDL_main $(top_builddir)/src/liblol.a @LOL_LIBS@
pi_LDFLAGS = $(top_builddir)/src/liblol.a @LOL_LIBS@
pi_DEPENDENCIES = $(top_builddir)/src/liblol.a

poly_SOURCES = poly.cpp


+ 1
- 1
test/testsuite.cpp View File

@@ -19,7 +19,7 @@

#include <lol/unit.h>

int main()
int main(int argc, char **argv)
{
lol::TextTestRunner runner;
bool success = runner.Run();


Loading…
Cancel
Save