sourcemm/oslink.h
author Scott Ehlert <ds@alliedmods.net>
Mon Apr 17 19:42:55 2006 +0000 (2006-04-17)
changeset 187 d81c2fc9a708
parent 175 b497b7777f6b
child 217 d0b778649744
permissions -rw-r--r--
Fixed a warning in stub and sample :|
     1 /* ======== SourceMM ========
     2 * Copyright (C) 2004-2006 Metamod:Source Development Team
     3 * No warranties of any kind
     4 *
     5 * License: zlib/libpng
     6 *
     7 * Author(s): David "BAILOPAN" Anderson
     8 * ============================
     9 */
    10 
    11 #ifndef _INCLUDE_OSLINK_H
    12 #define _INCLUDE_OSLINK_H
    13 
    14 /**
    15  * @brief Defines OS-independent information
    16  * @file oslink.h
    17  */
    18 
    19 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    20 	#define WIN32_LEAN_AND_MEAN
    21 	#define OS_WIN32
    22 	#include <windows.h>
    23 	#include <io.h>
    24 	#include <direct.h>
    25 	#define mkdir(a) _mkdir(a)
    26 	#define		dlmount(x)		LoadLibrary(x)
    27 	#define		dlsym(x, s)		GetProcAddress(x, s)
    28 	#define		dlclose(x)		FreeLibrary(x)
    29 	const char*	dlerror();
    30 	#define	PATH_SEP_STR	"\\"
    31 	#define PATH_SEP_CHAR	'\\'
    32 	#define ALT_SEP_CHAR	'/'
    33 	#define SERVER_DLL		"server.dll"
    34 #elif defined __linux__
    35 	#define OS_LINUX
    36 	#include <dlfcn.h>
    37 	#include <unistd.h>
    38 	#include <sys/types.h>
    39 	#include <dirent.h>
    40 	#define		dlmount(x)		dlopen(x,RTLD_NOW)
    41 	typedef		void*			HINSTANCE;
    42 	#define	PATH_SEP_STR	"/"
    43 	#define PATH_SEP_CHAR	'/'
    44 	#define ALT_SEP_CHAR	'\\'
    45 	#define	stricmp				strcasecmp
    46 	#define SERVER_DLL		"server_i486.so"
    47 #endif
    48 
    49 #if defined __linux__
    50 	extern int errno;
    51 	int GetLastError();
    52 #endif
    53 
    54 bool GetFileOfAddress(void *pAddr, char *buffer, size_t maxlength);
    55 
    56 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    57 	#define SMM_API extern "C" __declspec(dllexport)
    58 #elif defined __GNUC__
    59 	#define SMM_API	extern "C"
    60 #endif
    61 
    62 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    63 	typedef __int64				int64_t;
    64 	typedef unsigned __int64	uint64_t;
    65 #elif defined __GNUC__
    66 #include <stdint.h>
    67 #if !__GLIBC_HAVE_LONG_LONG
    68 	typedef long long			int64_t;
    69 	typedef unsigned long long	uint64_t;
    70 #endif
    71 #endif
    72 
    73 #ifndef __linux__
    74 	#define snprintf	_snprintf
    75 	#define vsnprintf	_vsnprintf
    76 #endif
    77 
    78 #endif //_INCLUDE_OSLINK_H