0ad/source/lib/sysdep/win/wposix/wposix_internal.h
janwas 95f8aa126f # fixes for overzealous vc8 optimization and housekeeping
these are required by thesis and improve 0ad code.
- sysdep/win init/shutdown mechanism is now better documented and
survives clever vc8 optimization
- moved some extern declarations from win_internal into separate headers

main: remove debug_filter_add("LOADER") - was for my debugging
convenience

This was SVN commit r4752.
2007-01-07 16:50:36 +00:00

47 lines
1.2 KiB
C

#ifndef INCLUDED_WPOSIX_INTERNAL
#define INCLUDED_WPOSIX_INTERNAL
#include "lib/lib.h"
#include "../win_internal.h"
#include "werrno.h"
// we define some CRT functions (e.g. access), because they're otherwise
// only brought in by win-specific headers (here, <io.h>).
// define correctly for static or DLL CRT in case the original header
// is included, to avoid conflict warnings.
//
// note: try to avoid redefining CRT functions - if building against the
// DLL CRT, the declarations will be incompatible. adding _CRTIMP to the decl
// is a last resort (e.g. if the regular CRT headers would conflict).
#ifndef _CRTIMP
# ifdef _DLL
# define _CRTIMP __declspec(dllimport)
# else
# define _CRTIMP
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
extern _CRTIMP intptr_t _get_osfhandle(int);
extern _CRTIMP int _open_osfhandle(intptr_t, int);
extern _CRTIMP char* _getcwd(char*, size_t);
#ifdef __cplusplus
}
#endif
// cast intptr_t to HANDLE; centralized for easier changing, e.g. avoiding
// warnings. i = -1 converts to INVALID_HANDLE_VALUE (same value).
inline HANDLE HANDLE_from_intptr(intptr_t i)
{
return (HANDLE)((char*)0 + i);
}
#endif // #ifndef INCLUDED_WPOSIX_INTERNAL