WIN32 compilation error fixes.
[silc.git] / includes / silcwin32.h
1 /*
2
3   silcwin32.h
4
5   Author: Pekka Riikonen <priikone@silcnet.org>
6
7   Copyright (C) 2001 - 2003 Pekka Riikonen
8
9   This program is free software; you can redistribute it and/or modify
10   it under the terms of the GNU General Public License as published by
11   the Free Software Foundation; version 2 of the License.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18 */
19 /* Native WIN32 specific includes and definitions. */
20
21 #ifndef SILCWIN32_H
22 #define SILCWIN32_H
23
24 #include <windows.h>
25 #include <io.h>
26 #include <process.h>
27
28 #if defined(HAVE_SILCDEFS_H)
29 #include "regexpr.h"
30 #endif /* HAVE_SILCDEFS_H */
31
32 #define snprintf _snprintf
33 #define vsnprintf _vsnprintf
34
35 #ifdef WIN32
36 #define strcasecmp stricmp
37 #define strncasecmp strncmp
38 #endif
39
40 #ifdef WIN32
41 #ifndef DLL
42 #ifndef _LIB
43 #define DLLAPI __declspec(dllimport)
44 #else
45 #define DLLAPI  /* Nada, we use .DEF */
46 #endif
47 #else
48 #define DLLAPI  /* Nada, we use .DEF */
49 #endif
50 #endif
51
52 /* Some winsock compatiblity requirements */
53 #ifndef _WIN32_WINNT
54 #define _WIN32_WINNT 0x400
55 #else
56 #undef _WIN32_WINNT
57 #define _WIN32_WINNT 0x400
58 #endif /* _WIN32_WINNT */
59 #if !defined(SO_SYNCHRONOUS_NONALERT)
60 #define SO_SYNCHRONOUS_NONALERT 0x20
61 #endif
62 #if !defined(SO_OPENTYPE)
63 #define SO_OPENTYPE 0x7008
64 #endif
65
66 #undef inline
67 #define inline __inline
68
69 #undef sleep
70 #define sleep(x) Sleep((x) * 1000)
71
72 #endif