3 * ======================================================
5 * Copyright (C) 2004-2007 AlliedModders LLC and authors.
7 * ======================================================
9 * This software is provided 'as-is', without any express or implied warranty.
10 * In no event will the authors be held liable for any damages arising from
11 * the use of this software.
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software in a
19 * product, an acknowledgment in the product documentation would be
20 * appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must not be
22 * misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
28 #ifndef _INCLUDE_OSLINK_H
29 #define _INCLUDE_OSLINK_H
32 * @brief Defines OS-independent information
36 #if defined __WIN32__ || defined _WIN32 || defined WIN32
37 #define WIN32_LEAN_AND_MEAN
39 #if defined _MSC_VER && _MSC_VER >= 1400
42 #define mkdir(a) _mkdir(a)
47 #define dlmount(x) LoadLibrary(x)
48 #define dlsym(x, s) GetProcAddress(x, s)
49 #define dlclose(x) FreeLibrary(x)
50 const char* dlerror();
51 #define abspath(x, s) _fullpath(x, s, sizeof(x))
52 #define PATH_SEP_STR "\\"
53 #define PATH_SEP_CHAR '\\'
54 #define ALT_SEP_CHAR '/'
55 #define PATH_SIZE MAX_PATH
56 #define SERVER_DLL "server.dll"
57 #define strcasecmp stricmp
58 #elif defined __linux__
62 #include <sys/types.h>
64 typedef void* HINSTANCE;
65 #define dlmount(x) dlopen(x,RTLD_NOW)
66 #define abspath(x, s) realpath(s, x)
67 #define PATH_SEP_STR "/"
68 #define PATH_SEP_CHAR '/'
69 #define ALT_SEP_CHAR '\\'
70 #define PATH_SIZE PATH_MAX
71 #define stricmp strcasecmp
72 #define strnicmp strncasecmp
73 #define SERVER_DLL "server_i486.so"
81 bool GetFileOfAddress(void *pAddr, char *buffer, size_t maxlength);
83 #if defined __WIN32__ || defined _WIN32 || defined WIN32
84 #define SMM_API extern "C" __declspec(dllexport)
85 #elif defined __GNUC__
87 #define SMM_API extern "C" __attribute__ ((visibility("default")))
89 #define SMM_API extern "C"
93 #if defined __WIN32__ || defined _WIN32 || defined WIN32
94 typedef __int64 int64_t;
95 typedef unsigned __int64 uint64_t;
96 #elif defined __GNUC__
98 #if !__GLIBC_HAVE_LONG_LONG
99 typedef long long int64_t;
100 typedef unsigned long long uint64_t;
105 #define snprintf _snprintf
106 #define vsnprintf _vsnprintf
109 #endif //_INCLUDE_OSLINK_H