acl
3.5.3.0
acl_define_win32.h
浏览该文件的文档.
1
#ifndef ACL_DEFINE_WIN32_INCLUDE_H
2
#define ACL_DEFINE_WIN32_INCLUDE_H
3
4
/**
5
* _MSC_VER:
6
* see: https://docs.microsoft.com/zh-cn/cpp/preprocessor/predefined-macros?view=msvc-160&viewFallbackFrom=vs-2019
7
* vc++5.0 VS 5.0 1100
8
* vc++6.0 VS 6.0 1200
9
* vc++7.0 VS 2003 1310
10
* vc++8.0 VS 2005 1400
11
* vc++9.0 VS 2008 1500
12
* vc++10.0 VS 2010 1600
13
* vc++11.0 VS 2012 1700
14
* vc++14.0 VS 2015 1900
15
* vc++15.0 VS 2017 1911
16
* vc++16.0 VS 2019 1920
17
* vc++16.1 VS 2019 1921
18
* vc++16.2 VS 2019 1922
19
* vc++16.3 VS 2019 1923
20
* vc++16.4 VS 2019 1924
21
* vc++16.5 VS 2019 1925
22
* vc++16.6 VS 2019 1926
23
* vc++16.7 VS 2019 1927
24
*/
25
26
#if defined (_WIN32) || defined(_WIN64)
27
# define ACL_WINDOWS
28
# if _MSC_VER >= 1500
29
# ifndef _CRT_SECURE_NO_WARNINGS
30
# define _CRT_SECURE_NO_WARNINGS
31
# endif
32
# if _MSC_VER >= 1900
33
# ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
34
# define _WINSOCK_DEPRECATED_NO_WARNINGS
35
# endif
36
# endif
37
# endif
38
#elif defined(BORLAND_CB)
39
# define ACL_BCB_COMPILER
40
#endif
41
42
#if defined(_WIN32) || defined(_WIN64)
43
44
# ifdef acl_assert
45
# undef acl_assert
46
# endif
47
# define acl_assert(x) do \
48
{ \
49
if (!(x)) \
50
abort(); \
51
} while(0)
52
53
#ifdef ACL_LIB
54
# ifndef ACL_API
55
# define ACL_API
56
# endif
57
#elif defined(ACL_DLL) // || defined(_WINDLL)
58
# if defined(ACL_EXPORTS) || defined(acl_EXPORTS)
59
# ifndef ACL_API
60
# define ACL_API __declspec(dllexport)
61
# endif
62
# elif !defined(ACL_API)
63
# define ACL_API __declspec(dllimport)
64
# endif
65
#elif !defined(ACL_API)
66
# define ACL_API
67
#endif
68
69
/**
70
* see WINSOCK2.H, 用户需要预先定义此值,因其默认值为64,此外,该值不能设得太大,
71
* 尤其是在 X64 编译时更是如此,参考 fd_set 的结构定义:
72
* typedef struct fd_set {
73
* u_int fd_count;
74
* SOCKET fd_array[FD_SETSIZE];
75
* } fd_set;
76
* 当在 x64 环境下,当 FD_SETSIZE=50000 时,该结构占的空间大小为:
77
* 8 + sizeof(SOCKET) * FD_SETSIZE = 400008
78
* 而在 events_select_thr.c 的函数 event_loop 中声明了三个 fd_set 变量,
79
* 则该函数其所占用的栈空间大小 > 1MB,而 VC 默认的栈大小为 1MB,则当调用此
80
* 函数时就会造成线程栈溢出;
81
* 当需要将 FD_SSETSIZE 设得很大时,则需要调整可执行程序的栈空间大小,即在程序
82
* 编译链接时的选项中,将“堆栈保留大小”选项设大一些
83
*/
84
# ifndef FD_SETSIZE
85
# define FD_SETSIZE 40000
86
# endif
87
88
# include <fcntl.h>
89
# include <sys/stat.h>
90
# include <sys/types.h>
91
92
# ifndef ACL_WIN32_STDC
93
# define ACL_WIN32_STDC
94
# endif
95
96
/* # include <windows.h> */
97
/* # include <winsock2.h> */
98
# if(_MSC_VER >= 1300)
99
# include <winsock2.h>
100
# include <mswsock.h>
101
# else
102
# include <winsock.h>
103
# endif
104
105
# include <ws2tcpip.h>
/* for getaddrinfo */
106
/*# include <netioapi.h>*/
107
108
# ifdef ACL_BCB_COMPILER
109
# pragma hdrstop
110
# endif
111
# define _USE_FAST_MACRO
112
# define _USE_HTABLE_SEARCH
113
114
# ifndef PATH_SEP_C
115
# define PATH_SEP_C '\\'
116
# endif
117
# ifndef PATH_SEP_S
118
# define PATH_SEP_S "\\"
119
# endif
120
121
# undef ACL_HAS_PTHREAD
122
#endif
/* _WIN32 */
123
124
/* errno define */
125
#if defined(_WIN32) || defined(_WIN64)
126
# define ACL_ETIMEDOUT WSAETIMEDOUT
127
# define ACL_ENOMEM WSAENOBUFS
128
# define ACL_EINVAL WSAEINVAL
129
130
# define ACL_ECONNREFUSED WSAECONNREFUSED
131
# define ACL_ECONNRESET WSAECONNRESET
132
# define ACL_EHOSTDOWN WSAEHOSTDOWN
133
# define ACL_EHOSTUNREACH WSAEHOSTUNREACH
134
# define ACL_EINTR WSAEINTR
135
# define ACL_ENETDOWN WSAENETDOWN
136
# define ACL_ENETUNREACH WSAENETUNREACH
137
# define ACL_ENOTCONN WSAENOTCONN
138
# define ACL_EISCONN WSAEISCONN
139
# define ACL_EWOULDBLOCK WSAEWOULDBLOCK
140
# define ACL_EAGAIN ACL_EWOULDBLOCK
/* xxx */
141
# define ACL_ENOBUFS WSAENOBUFS
142
# define ACL_ECONNABORTED WSAECONNABORTED
143
# define ACL_EINPROGRESS WSAEINPROGRESS
144
# define ACL_EMFILE WSAEMFILE
145
146
# define ACL_SOCKET SOCKET
147
# define ACL_FILEFD unsigned int
148
# ifndef HAS_SOCKLEN_T
149
# define HAS_SOCKLEN_T
150
typedef
int
socklen_t;
151
# endif
152
# define ACL_SOCKET_INVALID INVALID_SOCKET
153
# define ACL_FILE_HANDLE HANDLE
154
# define ACL_FILE_INVALID INVALID_HANDLE_VALUE
155
# define ACL_DLL_HANDLE HINSTANCE
156
# define ACL_DLL_FARPROC FARPROC
157
# ifndef HAS_SSIZE_T
158
# define HAS_SSIZE_T
159
/* typedef intptr_t ssize_t; */
160
# if defined(_WIN64)
161
typedef
__int64 ssize_t;
162
# elif defined(_WIN32)
163
typedef
int
ssize_t;
164
# else
165
typedef
long
ssize_t;
166
# endif
167
# endif
168
169
# define ACL_INTERNAL_LOCK ACL_FLOCK_STYLE_FLOCK
170
171
# define acl_int64 __int64
172
# define acl_uint64 unsigned __int64
173
# define ACL_FMT_I64D "%I64d"
174
# define ACL_FMT_I64U "%I64u"
175
176
# ifdef ACL_BCB_COMPILER
177
/* # define acl_stat _tstati64 */
178
# define acl_stat stati64
179
# else
180
# ifdef ACL_HAVE_NO_STAT64
181
# define acl_stat _stat
182
# define acl_fstat _fstat
183
# else
184
# define acl_stat _stati64
185
# endif
186
# endif
187
188
ACL_API
int
acl_fstat(ACL_FILE_HANDLE fh,
struct
acl_stat *buf);
189
190
/* 线程局部变量 */
191
# if defined(ACL_BCB_COMPILER)
192
# define __thread
193
# else
194
# define __thread __declspec(thread)
195
# endif
196
197
/*
198
# ifdef ACL_BCB_COMPILER
199
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
200
# endif
201
*/
202
#endif
/* _WIN32 / _WIN64 */
203
204
#endif
/* __ACL_DEFINE_WIN32_INCLUDE_H__ */
include
acl
stdlib
acl_define_win32.h
生成于 2021年 九月 10日 星期五 11:14:43 , 为 acl使用
1.8.15