usbmodeswitch: Updated to v.1.2.6 from shibby's branch.
[tomato.git] / release / src / router / usbmodeswitch / jim / jim-win32compat.h
blob89e01f5375b3f1bd3c14aa32e57a517e44c999d5
1 #ifndef JIM_WIN32COMPAT_H
2 #define JIM_WIN32COMPAT_H
4 /* Compatibility for Windows (mingw and msvc, not cygwin */
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>
14 #define HAVE_DLOPEN
15 void *dlopen(const char *path, int mode);
16 int dlclose(void *handle);
17 void *dlsym(void *handle, const char *symbol);
18 char *dlerror(void);
20 #ifdef _MSC_VER
21 /* These are msvc vs gcc */
23 #if _MSC_VER >= 1000
24 #pragma warning(disable:4146)
25 #endif
27 #define strcasecmp _stricmp
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"
40 #include <io.h>
42 #define HAVE_GETTIMEOFDAY
43 struct timeval {
44 long tv_sec;
45 long tv_usec;
48 int gettimeofday(struct timeval *tv, void *unused);
50 #define HAVE_OPENDIR
51 struct dirent {
52 char *d_name;
55 typedef 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;
62 DIR *opendir(const char *name);
63 int closedir(DIR *dir);
64 struct dirent *readdir(DIR *dir);
65 #endif /* _MSC_VER */
67 #endif /* WIN32 */
69 #endif