1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2007 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
11 #ifndef _INCLUDE_OSLINK_H
12 #define _INCLUDE_OSLINK_H
15 * @brief Defines OS-independent information
19 #if defined __WIN32__ || defined _WIN32 || defined WIN32
20 #define WIN32_LEAN_AND_MEAN
22 #if defined _MSC_VER && _MSC_VER >= 1400
25 #define mkdir(a) _mkdir(a)
30 #define dlmount(x) LoadLibrary(x)
31 #define dlsym(x, s) GetProcAddress(x, s)
32 #define dlclose(x) FreeLibrary(x)
33 const char* dlerror();
34 #define abspath(x, s) _fullpath(x, s, sizeof(x))
35 #define PATH_SEP_STR "\\"
36 #define PATH_SEP_CHAR '\\'
37 #define ALT_SEP_CHAR '/'
38 #define PATH_SIZE MAX_PATH
39 #define SERVER_DLL "server.dll"
40 #elif defined __linux__
44 #include <sys/types.h>
46 typedef void* HINSTANCE;
47 #define dlmount(x) dlopen(x,RTLD_NOW)
48 #define abspath(x, s) realpath(s, x)
49 #define PATH_SEP_STR "/"
50 #define PATH_SEP_CHAR '/'
51 #define ALT_SEP_CHAR '\\'
52 #define PATH_SIZE PATH_MAX
53 #define stricmp strcasecmp
54 #define strnicmp strncasecmp
55 #define SERVER_DLL "server_i486.so"
63 bool GetFileOfAddress(void *pAddr, char *buffer, size_t maxlength);
65 #if defined __WIN32__ || defined _WIN32 || defined WIN32
66 #define SMM_API extern "C" __declspec(dllexport)
67 #elif defined __GNUC__
69 #define SMM_API extern "C" __attribute__ ((visibility("default")))
71 #define SMM_API extern "C"
75 #if defined __WIN32__ || defined _WIN32 || defined WIN32
76 typedef __int64 int64_t;
77 typedef unsigned __int64 uint64_t;
78 #elif defined __GNUC__
80 #if !__GLIBC_HAVE_LONG_LONG
81 typedef long long int64_t;
82 typedef unsigned long long uint64_t;
87 #define snprintf _snprintf
88 #define vsnprintf _vsnprintf
91 #endif //_INCLUDE_OSLINK_H