1#ifndef JIM_WIN32COMPAT_H 2#define JIM_WIN32COMPAT_H 3 4/* Compatibility for Windows (mingw and msvc, not cygwin */ 5 6/* Note that at this point we don't yet have access to jimautoconf.h */ 7#if defined(_WIN32) || defined(WIN32) 8#ifndef STRICT 9 #define STRICT 10#endif 11#define WIN32_LEAN_AND_MEAN 12#include <windows.h> 13 14#define HAVE_DLOPEN 15void *dlopen(const char *path, int mode); 16int dlclose(void *handle); 17void *dlsym(void *handle, const char *symbol); 18char *dlerror(void); 19 20#ifdef _MSC_VER 21/* These are msvc vs gcc */ 22 23#if _MSC_VER >= 1000 24 #pragma warning(disable:4146) 25#endif 26 27#define strcasecmp _stricmp 28 29#define jim_wide _int64 30#ifndef LLONG_MAX 31 #define LLONG_MAX 9223372036854775807I64 32#endif 33#ifndef LLONG_MIN 34 #define LLONG_MIN (-LLONG_MAX - 1I64) 35#endif 36#define JIM_WIDE_MIN LLONG_MIN 37#define JIM_WIDE_MAX LLONG_MAX 38#define JIM_WIDE_MODIFIER "I64d" 39 40#include <io.h> 41 42#define HAVE_GETTIMEOFDAY 43struct timeval { 44 long tv_sec; 45 long tv_usec; 46}; 47 48int gettimeofday(struct timeval *tv, void *unused); 49 50#define HAVE_OPENDIR 51struct dirent { 52 char *d_name; 53}; 54 55typedef struct DIR { 56 long handle; /* -1 for failed rewind */ 57 struct _finddata_t info; 58 struct dirent result; /* d_name null iff first time */ 59 char *name; /* null-terminated char string */ 60} DIR; 61 62DIR *opendir(const char *name); 63int closedir(DIR *dir); 64struct dirent *readdir(DIR *dir); 65#endif /* _MSC_VER */ 66 67#endif /* WIN32 */ 68 69#endif 70