Sese Framework  2.3.0
A cross-platform framework
Loading...
Searching...
No Matches
WindowsConfig.h
Go to the documentation of this file.
1// Copyright 2024 libsese
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
22#pragma once
23
24#if !defined(_WIN32_WINNET) || _WIN32_WINNI < 0x0602
25#define _WIN32_WINNNT 0x0602
26#endif
27
28#ifndef WINVER
29#define WINVER 0x0602
30#endif
31
32#ifndef NOMINMAX
33#define NOMINMAX
34#endif
35
36#include <winsock2.h>
37#include <windows.h>
38
39#undef min
40#undef max
41
42#pragma warning(disable : 4819)
43
44#if defined(_M_X64)
45#define SESE_ARCH_X64
46#elif defined(_M_ARM64)
47#define SESE_ARCH_ARM64
48#else
49#error only support x86_64 & arm64
50#endif
51
53#define SESE_CXX_STANDARD _MSVC_LANG
54
56#define API
57
59#define PRIdTid "u"
60
61#ifndef __MINGW32__
63#define strcasecmp strcmpi
64#endif
65
66#ifndef timegm
67#define timegm _mkgmtime
68#endif
69
70#if defined(__MINGW32__)
71#define SESE_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
72#else
73#define SESE_FILENAME (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__)
74#endif
75
76namespace sese {
78using pid_t = DWORD;
80using tid_t = uint32_t;
82using socket_t = SOCKET;
83} // namespace sese
84
86
87#undef EINTR
88#undef EBADF
89#undef EACCES
90#undef EFAULT
91#undef EINVAL
92#undef EMFILE
93#undef EWOULDBLOCK
94#undef EINPROGRESS
95#undef EALREADY
96#undef ENOTSOCK
97#undef EDESTADDRREQ
98#undef EMSGSIZE
99#undef EPROTOTYPE
100#undef ENOPROTOOPT
101#undef EPROTONOSUPPORT
102#undef ESOCKTNOSUPPORT
103#undef EOPNOTSUPP
104#undef EPFNOSUPPORT
105#undef EAFNOSUPPORT
106#undef EADDRINUSE
107#undef EADDRNOTAVAIL
108#undef ENETDOWN
109#undef ENETUNREACH
110#undef ENETRESET
111#undef ECONNABORTED
112#undef ECONNRESET
113#undef ENOBUFS
114#undef EISCONN
115#undef ENOTCONN
116#undef ESHUTDOWN
117#undef ETOOMANYREFS
118#undef ETIMEDOUT
119#undef ECONNREFUSED
120#undef ELOOP
121#undef ENAMETOOLONG
122#undef EHOSTDOWN
123#undef EHOSTUNREACH
124#undef ENOTEMPTY
125#undef EPROCLIM
126#undef EUSERS
127#undef EDQUOT
128#undef ESTALE
129#undef EREMOTE
130
131#define EINTR WSAEINTR
132#define EBADF WSAEBADF
133#define EACCES WSAEACCES
134#define EFAULT WSAEFAULT
135#define EINVAL WSAEINVAL
136#define EMFILE WSAEMFILE
137#define EWOULDBLOCK WSAEWOULDBLOCK
138#define EINPROGRESS WSAEINPROGRESS
139#define EALREADY WSAEALREADY
140#define ENOTSOCK WSAENOTSOCK
141#define EDESTADDRREQ WSAEDESTADDRREQ
142#define EMSGSIZE WSAEMSGSIZE
143#define EPROTOTYPE WSAEPROTOTYPE
144#define ENOPROTOOPT WSAENOPROTOOPT
145#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
146#define ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
147#define EOPNOTSUPP WSAEOPNOTSUPP
148#define EPFNOSUPPORT WSAEPFNOSUPPORT
149#define EAFNOSUPPORT WSAEAFNOSUPPORT
150#define EADDRINUSE WSAEADDRINUSE
151#define EADDRNOTAVAIL WSAEADDRNOTAVAIL
152#define ENETDOWN WSAENETDOWN
153#define ENETUNREACH WSAENETUNREACH
154#define ENETRESET WSAENETRESET
155#define ECONNABORTED WSAECONNABORTED
156#define ECONNRESET WSAECONNRESET
157#define ENOBUFS WSAENOBUFS
158#define EISCONN WSAEISCONN
159#define ENOTCONN WSAENOTCONN
160#define ESHUTDOWN WSAESHUTDOWN
161#define ETOOMANYREFS WSAETOOMANYREFS
162#define ETIMEDOUT WSAETIMEDOUT
163#define ECONNREFUSED WSAECONNREFUSED
164#define ELOOP WSAELOOP
165#define ENAMETOOLONG WSAENAMETOOLONG
166#define EHOSTDOWN WSAEHOSTDOWN
167#define EHOSTUNREACH WSAEHOSTUNREACH
168#define ENOTEMPTY WSAENOTEMPTY
169#define EPROCLIM WSAEPROCLIM
170#define EUSERS WSAEUSERS
171#define EDQUOT WSAEDQUOT
172#define ESTALE WSAESTALE
173#define EREMOTE WSAEREMOTE