From 33d2331255fad78a68cf44cfb314ab404e2274d9 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Sat, 24 Jan 2015 23:09:49 +0100 Subject: [PATCH] Adjust version header to resolve linker conflict with two definitions of love::VERSION in android builds NOTE: Sadly, on some platforms, like linux, the linker is "smart" enough to have the previous code be completely ineffective, the checking will only work with versions of love >= 0.9.2 --- src/common/version.h | 3 ++- src/love.cpp | 4 ++-- src/modules/love/love.cpp | 4 +++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/common/version.h b/src/common/version.h index ba4b15259..f96c42d15 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -25,10 +25,11 @@ namespace love { // Version stuff. +#define LOVE_VERSION_STRING "0.9.2" const int VERSION_MAJOR = 0; const int VERSION_MINOR = 9; const int VERSION_REV = 2; -const char *VERSION = "0.9.2"; +const char *VERSION = LOVE_VERSION_STRING; const char *VERSION_COMPATIBILITY[] = { VERSION, "0.9.1", "0.9.0", 0 }; const char *VERSION_CODENAME = "Baby Inspector"; diff --git a/src/love.cpp b/src/love.cpp index 1ce585252..64e3fed72 100644 --- a/src/love.cpp +++ b/src/love.cpp @@ -151,10 +151,10 @@ int main(int argc, char **argv) argv = hack_argv; #endif // LOVE_LEGENDARY_APP_ARGV_HACK - if (strcmp(love::VERSION, love_version()) != 0) + if (strcmp(LOVE_VERSION_STRING, love_version()) != 0) { printf("Version mismatch detected!\nLOVE binary is version %s\n" - "LOVE library is version %s\n", love::VERSION, love_version()); + "LOVE library is version %s\n", LOVE_VERSION_STRING, love_version()); return 1; } diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index fae80d244..6ff11df90 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -165,7 +165,9 @@ int w__openConsole(lua_State *L); const char *love_version() { - return love::VERSION; + // Do not refer to love::VERSION here, the linker + // will patch it back up to the executable's one.. + return LOVE_VERSION_STRING; } const char *love_codename()