sourcemm/sample_mm/oslink.h
changeset 35 78188da97068
child 218 d40365b50d43
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/sourcemm/sample_mm/oslink.h	Fri Apr 22 14:36:21 2005 +0000
     1.3 @@ -0,0 +1,66 @@
     1.4 +/* ======== SourceMM ========
     1.5 +* Copyright (C) 2004-2005 Metamod:Source Development Team
     1.6 +* No warranties of any kind
     1.7 +*
     1.8 +* License: zlib/libpng
     1.9 +*
    1.10 +* Author(s): David "BAILOPAN" Anderson
    1.11 +* ============================
    1.12 +*/
    1.13 +
    1.14 +#ifndef _INCLUDE_OSLINK_H
    1.15 +#define _INCLUDE_OSLINK_H
    1.16 +
    1.17 +/**
    1.18 + * @brief Defines OS-independent information
    1.19 + * @file oslink.h
    1.20 + */
    1.21 +
    1.22 +#if defined __WIN32__ || defined _WIN32 || defined WIN32
    1.23 +	#define WIN32_LEAN_AND_MEAN
    1.24 +	#define OS_WIN32
    1.25 +	#include <windows.h>
    1.26 +	#include <io.h>
    1.27 +	#include <direct.h>
    1.28 +	#define mkdir(a) _mkdir(a)
    1.29 +	#define		dlmount(x)		LoadLibrary(x)
    1.30 +	#define		dlsym(x, s)		GetProcAddress(x, s)
    1.31 +	#define		dlclose(x)		FreeLibrary(x)
    1.32 +	const char*	dlerror();
    1.33 +#elif defined __linux__
    1.34 +	#define OS_LINUX
    1.35 +	#include <dlfcn.h>
    1.36 +	#include <unistd.h>
    1.37 +	#include <sys/types.h>
    1.38 +	#include <dirent.h>
    1.39 +	#define		dlmount(x)		dlopen(x,RTLD_NOW)
    1.40 +	typedef		void*			HINSTANCE;
    1.41 +#endif
    1.42 +
    1.43 +#if defined __linux__
    1.44 +	extern int errno;
    1.45 +	int GetLastError();
    1.46 +#endif
    1.47 +
    1.48 +#if defined __WIN32__ || defined _WIN32 || defined WIN32
    1.49 +	#define SMM_API extern "C" __declspec(dllexport)
    1.50 +#elif defined __GNUC__
    1.51 +	#define SMM_API	extern "C"
    1.52 +#endif
    1.53 +
    1.54 +#if defined __WIN32__ || defined _WIN32 || defined WIN32
    1.55 +	typedef __int64				int64_t;
    1.56 +	typedef unsigned __int64	uint64_t;
    1.57 +#elif defined __GNUC__
    1.58 +# if !__GLIBC_HAVE_LONG_LONG
    1.59 +	typedef long long			int64_t;
    1.60 +# endif
    1.61 +	typedef unsigned long long	uint64_t;
    1.62 +#endif
    1.63 +
    1.64 +#ifndef __linux__
    1.65 +	#define snprintf	_snprintf
    1.66 +	#define vsnprintf	_vsnprintf
    1.67 +#endif
    1.68 +
    1.69 +#endif //_INCLUDE_OSLINK_H