mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-01-31 20:52:18 +01:00
Attempt at fixing windows build errors.
This commit is contained in:
parent
48a799dbd8
commit
e1a9b482b3
@ -11,6 +11,8 @@
|
|||||||
#include "gamedll.h"
|
#include "gamedll.h"
|
||||||
#include "valve_commandline.h"
|
#include "valve_commandline.h"
|
||||||
|
|
||||||
|
#undef GetCommandLine
|
||||||
|
|
||||||
class IServerGameDLL;
|
class IServerGameDLL;
|
||||||
typedef ICommandLine *(*GetCommandLine)();
|
typedef ICommandLine *(*GetCommandLine)();
|
||||||
|
|
||||||
|
@ -52,22 +52,6 @@ static const char *backend_names[3] =
|
|||||||
#define LIBRARY_MINEXT ".so"
|
#define LIBRARY_MINEXT ".so"
|
||||||
#endif
|
#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
|
bool
|
||||||
mm_LoadMetamodLibrary(MetamodBackend backend, char *buffer, size_t maxlength)
|
mm_LoadMetamodLibrary(MetamodBackend backend, char *buffer, size_t maxlength)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,23 @@
|
|||||||
#include "loader.h"
|
#include "loader.h"
|
||||||
#include "utility.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
|
size_t
|
||||||
mm_FormatArgs(char *buffer, size_t maxlength, const char *fmt, va_list params)
|
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;
|
void *lib;
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
lib = LoadLibrary(path);
|
lib = (void*)LoadLibrary(path);
|
||||||
|
|
||||||
if (lib == NULL)
|
if (lib == NULL)
|
||||||
{
|
{
|
||||||
@ -262,7 +279,7 @@ void *
|
|||||||
mm_GetLibAddress(void *lib, const char *name)
|
mm_GetLibAddress(void *lib, const char *name)
|
||||||
{
|
{
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
return GetProcAddress(lib, name);
|
return GetProcAddress((HMODULE)lib, name);
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
return dlsym(lib, name);
|
return dlsym(lib, name);
|
||||||
#endif
|
#endif
|
||||||
@ -272,7 +289,7 @@ void
|
|||||||
mm_UnloadLibrary(void *lib)
|
mm_UnloadLibrary(void *lib)
|
||||||
{
|
{
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
FreeLibrary(lib);
|
FreeLibrary((HMODULE)lib);
|
||||||
#else
|
#else
|
||||||
dlclose(lib);
|
dlclose(lib);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user