sourcemm/sample_mm/oslink.h
author Scott Ehlert <ds@alliedmods.net>
Thu Jul 20 11:31:41 2006 +0000 (2006-07-20)
changeset 223 f44cad5df4e8
parent 222 9c9087367e2b
permissions -rw-r--r--
I shouldn't have touched this again in the first place
     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 	#if defined _MSC_VER && _MSC_VER >= 1400
    23 		#undef ARRAYSIZE
    24 	#else
    25 		#define mkdir(a) _mkdir(a)
    26 	#endif
    27 	#include <windows.h>
    28 	#include <io.h>
    29 	#include <direct.h>
    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 #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 #endif
    43 
    44 #if defined __linux__
    45 	extern int errno;
    46 	int GetLastError();
    47 #endif
    48 
    49 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    50 	#define SMM_API extern "C" __declspec(dllexport)
    51 #elif defined __GNUC__
    52 	#define SMM_API	extern "C"
    53 #endif
    54 
    55 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    56 	typedef __int64				int64_t;
    57 	typedef unsigned __int64	uint64_t;
    58 #elif defined __GNUC__
    59 #if !__GLIBC_HAVE_LONG_LONG
    60 	typedef long long			int64_t;
    61 	typedef unsigned long long	uint64_t;
    62 #endif
    63 #endif
    64 
    65 #ifndef __linux__
    66 	#define snprintf	_snprintf
    67 	#define vsnprintf	_vsnprintf
    68 #endif
    69 
    70 #endif //_INCLUDE_OSLINK_H