1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

Attempt at fixing windows build errors.

This commit is contained in:
David Anderson 2008-11-23 22:10:16 -06:00
parent 48a799dbd8
commit e1a9b482b3
3 changed files with 22 additions and 19 deletions

View File

@ -11,6 +11,8 @@
#include "gamedll.h"
#include "valve_commandline.h"
#undef GetCommandLine
class IServerGameDLL;
typedef ICommandLine *(*GetCommandLine)();

View File

@ -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)
{

View File

@ -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