sourcemm/sample_mm/oslink.h
author Scott Ehlert <ds@alliedmods.net>
Sun May 22 04:33:58 2005 +0000 (2005-05-22)
changeset 66 ddefc8bfb9fa
parent 35 78188da97068
child 218 d40365b50d43
permissions -rw-r--r--
Added macro so that ConCommands created with the SDK's CON_COMMAND and CON_COMMAND_F macros can be properly registered and unregisterd
     1 /* ======== SourceMM ========
     2 * Copyright (C) 2004-2005 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 #elif defined __linux__
    31 	#define OS_LINUX
    32 	#include <dlfcn.h>
    33 	#include <unistd.h>
    34 	#include <sys/types.h>
    35 	#include <dirent.h>
    36 	#define		dlmount(x)		dlopen(x,RTLD_NOW)
    37 	typedef		void*			HINSTANCE;
    38 #endif
    39 
    40 #if defined __linux__
    41 	extern int errno;
    42 	int GetLastError();
    43 #endif
    44 
    45 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    46 	#define SMM_API extern "C" __declspec(dllexport)
    47 #elif defined __GNUC__
    48 	#define SMM_API	extern "C"
    49 #endif
    50 
    51 #if defined __WIN32__ || defined _WIN32 || defined WIN32
    52 	typedef __int64				int64_t;
    53 	typedef unsigned __int64	uint64_t;
    54 #elif defined __GNUC__
    55 # if !__GLIBC_HAVE_LONG_LONG
    56 	typedef long long			int64_t;
    57 # endif
    58 	typedef unsigned long long	uint64_t;
    59 #endif
    60 
    61 #ifndef __linux__
    62 	#define snprintf	_snprintf
    63 	#define vsnprintf	_vsnprintf
    64 #endif
    65 
    66 #endif //_INCLUDE_OSLINK_H