From e1a9b482b32091932ddacf31accb2a93ae1159ec Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 23 Nov 2008 22:10:16 -0600 Subject: [PATCH] Attempt at fixing windows build errors. --- loader/gamedll.cpp | 2 ++ loader/loader.cpp | 16 ---------------- loader/utility.cpp | 23 ++++++++++++++++++++--- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/loader/gamedll.cpp b/loader/gamedll.cpp index 4b9a89a..ae9fe83 100644 --- a/loader/gamedll.cpp +++ b/loader/gamedll.cpp @@ -11,6 +11,8 @@ #include "gamedll.h" #include "valve_commandline.h" +#undef GetCommandLine + class IServerGameDLL; typedef ICommandLine *(*GetCommandLine)(); diff --git a/loader/loader.cpp b/loader/loader.cpp index 910e7a7..61dccb1 100644 --- a/loader/loader.cpp +++ b/loader/loader.cpp @@ -52,22 +52,6 @@ static const char *backend_names[3] = #define LIBRARY_MINEXT ".so" #endif -#if defined _WIN32 -void -mm_GetPlatformError(char *buffer, size_t maxlength) -{ - DWORD dw = GetLastError(); - FormatMessageA( - FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)buffer, - maxlength, - NULL); -} -#endif - bool mm_LoadMetamodLibrary(MetamodBackend backend, char *buffer, size_t maxlength) { diff --git a/loader/utility.cpp b/loader/utility.cpp index 95d2553..0d875df 100644 --- a/loader/utility.cpp +++ b/loader/utility.cpp @@ -7,6 +7,23 @@ #include "loader.h" #include "utility.h" +#if defined _WIN32 +static void +mm_GetPlatformError(char *buffer, size_t maxlength) +{ + DWORD dw = GetLastError(); + FormatMessageA( + FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPSTR)buffer, + maxlength, + NULL); +} +#endif + + size_t mm_FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list params) { @@ -238,7 +255,7 @@ mm_LoadLibrary(const char *path, char *buffer, size_t maxlength) void *lib; #if defined _WIN32 - lib = LoadLibrary(path); + lib = (void*)LoadLibrary(path); if (lib == NULL) { @@ -262,7 +279,7 @@ void * mm_GetLibAddress(void *lib, const char *name) { #if defined _WIN32 - return GetProcAddress(lib, name); + return GetProcAddress((HMODULE)lib, name); #elif defined __linux__ return dlsym(lib, name); #endif @@ -272,7 +289,7 @@ void mm_UnloadLibrary(void *lib) { #if defined _WIN32 - FreeLibrary(lib); + FreeLibrary((HMODULE)lib); #else dlclose(lib); #endif