tcltest: do a better job of cleanup up after tests
[jimtcl.git] / jim-win32compat.h
blob371f7bde11075ead75e8c5b043de0254b86c0322
1 #ifndef JIM_WIN32COMPAT_H
2 #define JIM_WIN32COMPAT_H
4 /* Compatibility for Windows (mingw and msvc, not cygwin */
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 /* Note that at this point we don't yet have access to jimautoconf.h */
11 #if defined(_WIN32) || defined(WIN32)
13 #define HAVE_DLOPEN
14 void *dlopen(const char *path, int mode);
15 int dlclose(void *handle);
16 void *dlsym(void *handle, const char *symbol);
17 char *dlerror(void);
19 /* MinGW MS CRT always uses three digits after 'e' */
20 #if defined(__MINGW32__)
21 #define JIM_SPRINTF_DOUBLE_NEEDS_FIX
22 #endif
24 /* MinGW does not have group/owner permissions */
25 #ifndef S_IRWXG
26 #define S_IRWXG 0
27 #endif
28 #ifndef S_IRWXO
29 #define S_IRWXO 0
30 #endif
32 #ifdef _MSC_VER
33 /* These are msvc vs gcc */
35 #if _MSC_VER >= 1000
36 #pragma warning(disable:4146)
37 #endif
39 #include <limits.h>
40 #define jim_wide _int64
41 #ifndef LLONG_MAX
42 #define LLONG_MAX 9223372036854775807I64
43 #endif
44 #ifndef LLONG_MIN
45 #define LLONG_MIN (-LLONG_MAX - 1I64)
46 #endif
47 #define JIM_WIDE_MIN LLONG_MIN
48 #define JIM_WIDE_MAX LLONG_MAX
49 #define JIM_WIDE_MODIFIER "I64d"
50 #define strcasecmp _stricmp
51 #define strtoull _strtoui64
52 #define snprintf _snprintf
54 #include <io.h>
56 struct timeval {
57 long tv_sec;
58 long tv_usec;
61 int gettimeofday(struct timeval *tv, void *unused);
63 #define HAVE_OPENDIR
64 struct dirent {
65 char *d_name;
68 typedef struct DIR {
69 long handle; /* -1 for failed rewind */
70 struct _finddata_t info;
71 struct dirent result; /* d_name null iff first time */
72 char *name; /* null-terminated char string */
73 } DIR;
75 DIR *opendir(const char *name);
76 int closedir(DIR *dir);
77 struct dirent *readdir(DIR *dir);
79 #elif defined(__MINGW32__)
81 #include <stdlib.h>
82 #define strtod __strtod
84 #endif
86 #endif /* WIN32 */
88 #ifdef __cplusplus
90 #endif
92 #endif