diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2015-10-21 04:05:29 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2015-10-21 04:05:29 +0000 |
| commit | f2e065dee10fb110e9d51175ee6381333319ef56 (patch) | |
| tree | da85ca78fe050280d7592bf6bf1071410846031f /External/lua-5.2.3/src/winappstubs.h | |
| download | DiligentTools-f2e065dee10fb110e9d51175ee6381333319ef56.tar.gz DiligentTools-f2e065dee10fb110e9d51175ee6381333319ef56.zip | |
Release v1.0.0
Diffstat (limited to 'External/lua-5.2.3/src/winappstubs.h')
| -rw-r--r-- | External/lua-5.2.3/src/winappstubs.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/External/lua-5.2.3/src/winappstubs.h b/External/lua-5.2.3/src/winappstubs.h new file mode 100644 index 0000000..1954ac7 --- /dev/null +++ b/External/lua-5.2.3/src/winappstubs.h @@ -0,0 +1,66 @@ +/* +** $Id: winappstubs.h, Egor Yusov +** Stubs for functions unavailable +** for Windows Store Apps +*/ + +#ifndef winappstubs_h +#define winappstubs_h + +#include <stdio.h> +#include <cassert> + +// Do NOT include windows headers! They #define CreateDirectory, +// DeleteFile, min, max, and do other evil. +// This file is included by luaconf.h, which is in turn included by +// lua.h. So including windows headers here will propagate to every +// file that uses lua.h. +// #define NOMINMAX +// #include <Windows.h> + +#define Unsupported(Message) assert(Message && false); + +inline int _pclose( FILE * ) +{ + Unsupported("_pclose() is not available for Windows App Store applications"); + return 0; +} + +inline FILE *_popen( const char *, const char * ) +{ + Unsupported("_popen() is not available for Windows App Store applications"); + return nullptr; +} + +inline int system( const char* command ) +{ + Unsupported("system() is not available for Windows App Store applications"); + return 0; +} + +inline char* getenv( const char* name ) +{ + Unsupported("getenv() is not available for Windows App Store applications"); + return nullptr; +} + +// Definitions of windows types are not available for us as we want to avoid +// inclusion of windows headers +template<typename HMODULE, typename LPSTR, typename DWORD> +inline DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize) +{ + Unsupported("GetModuleFileNameA() is not available for Windows App Store applications"); + return 0; +} + + +template<typename HMODULE, typename LPCSTR, typename HANDLE, typename DWORD> +inline HMODULE LoadLibraryExA_stub(LPCSTR lpFileName, HANDLE hFile, DWORD dwFlags) +{ + Unsupported("LoadLibraryExA() is not available for Windows App Store applications"); + return 0; +} +// HMODULE will be defined where this macro is used, so we do not have to define it +#define LoadLibraryExA(lpFileName, hFile, dwFlags) LoadLibraryExA_stub<HMODULE>(lpFileName, hFile, dwFlags) + +#endif |
