4 * Copyright 2000 Francois Gouget.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __WINE_CORECRT_H
22 #define __WINE_CORECRT_H
24 #ifndef __WINE_USE_MSVCRT
25 #define __WINE_USE_MSVCRT
28 #ifdef __WINE_WINE_PORT_H
29 # error You cannot use both wine/port.h and msvcrt headers
32 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
37 # define _MSVCR_VER 140
40 #if !defined(_UCRT) && _MSVCR_VER >= 140
44 #if !defined(_MSC_VER) && !defined(__int64)
45 # if defined(_WIN64) && !defined(__MINGW64__)
48 # define __int64 long long
56 #define NULL ((void *)0)
60 #ifndef __has_attribute
61 #define __has_attribute(x) 0
68 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
69 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
71 # define __stdcall __attribute__((__stdcall__))
74 # error You need to define __stdcall for your compiler
76 # elif defined(__x86_64__) && defined (__GNUC__)
77 # if __has_attribute(__force_align_arg_pointer__)
78 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
80 # define __stdcall __attribute__((ms_abi))
82 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(_WIN32)
83 # define __stdcall __attribute__((pcs("aapcs-vfp")))
84 # elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi)
85 # define __stdcall __attribute__((ms_abi))
88 # endif /* __i386__ */
89 #endif /* __stdcall */
93 # if defined(__i386__) && defined(__GNUC__)
94 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
95 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
97 # define __cdecl __attribute__((__cdecl__))
100 # define __cdecl __stdcall
105 # if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__)
106 # define __ms_va_list __builtin_ms_va_list
107 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
108 # define __ms_va_end(list) __builtin_ms_va_end(list)
109 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
111 # define __ms_va_list va_list
112 # define __ms_va_start(list,arg) va_start(list,arg)
113 # define __ms_va_end(list) va_end(list)
115 # define __ms_va_copy(dest,src) va_copy(dest,src)
117 # define __ms_va_copy(dest,src) ((dest) = (src))
123 # if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(_WIN32)
124 # define WINAPIV __attribute__((pcs("aapcs")))
126 # define WINAPIV __cdecl
130 #ifndef DECLSPEC_NORETURN
131 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
132 # define DECLSPEC_NORETURN __declspec(noreturn)
133 # elif defined(__GNUC__)
134 # define DECLSPEC_NORETURN __attribute__((noreturn))
136 # define DECLSPEC_NORETURN
140 #ifndef DECLSPEC_ALIGN
141 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
142 # define DECLSPEC_ALIGN(x) __declspec(align(x))
143 # elif defined(__GNUC__)
144 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
146 # define DECLSPEC_ALIGN(x)
152 # define _ACRTIMP _CRTIMP
153 # elif defined(_MSC_VER)
154 # define _ACRTIMP __declspec(dllimport)
155 # elif defined(__MINGW32__) || defined(__CYGWIN__)
156 # define _ACRTIMP __attribute__((dllimport))
163 #define _CRT_INT_MAX 0x7fffffff
165 #ifndef _MSVCRT_LONG_DEFINED
166 #define _MSVCRT_LONG_DEFINED
167 /* we need 32-bit longs even on 64-bit */
169 typedef int __msvcrt_long
;
170 typedef unsigned int __msvcrt_ulong
;
172 typedef long __msvcrt_long
;
173 typedef unsigned long __msvcrt_ulong
;
177 #ifndef _INTPTR_T_DEFINED
179 typedef __int64
intptr_t;
181 typedef int intptr_t;
183 #define _INTPTR_T_DEFINED
186 #ifndef _UINTPTR_T_DEFINED
188 typedef unsigned __int64
uintptr_t;
190 typedef unsigned int uintptr_t;
192 #define _UINTPTR_T_DEFINED
195 #ifndef _PTRDIFF_T_DEFINED
197 typedef __int64
ptrdiff_t;
199 typedef int ptrdiff_t;
201 #define _PTRDIFF_T_DEFINED
204 #ifndef _SIZE_T_DEFINED
206 typedef unsigned __int64
size_t;
208 typedef unsigned int size_t;
210 #define _SIZE_T_DEFINED
213 #ifndef _TIME32_T_DEFINED
214 typedef __msvcrt_long __time32_t
;
215 #define _TIME32_T_DEFINED
218 #ifndef _TIME64_T_DEFINED
219 typedef __int64
DECLSPEC_ALIGN(8) __time64_t
;
220 #define _TIME64_T_DEFINED
223 #ifdef _USE_32BIT_TIME_T
225 # error You cannot use 32-bit time_t in Win64
227 #elif !defined(_WIN64)
228 # define _USE_32BIT_TIME_T
231 #ifndef _TIME_T_DEFINED
232 #ifdef _USE_32BIT_TIME_T
233 typedef __time32_t
time_t;
235 typedef __time64_t
time_t;
237 #define _TIME_T_DEFINED
240 #ifndef _WCHAR_T_DEFINED
242 typedef unsigned short wchar_t;
244 #define _WCHAR_T_DEFINED
247 #ifndef _WCTYPE_T_DEFINED
248 typedef unsigned short wint_t;
249 typedef unsigned short wctype_t;
250 #define _WCTYPE_T_DEFINED
253 #ifndef _ERRNO_T_DEFINED
255 #define _ERRNO_T_DEFINED
258 struct threadlocaleinfostruct
;
259 struct threadmbcinfostruct
;
260 typedef struct threadlocaleinfostruct
*pthreadlocinfo
;
261 typedef struct threadmbcinfostruct
*pthreadmbcinfo
;
263 typedef struct localeinfo_struct
265 pthreadlocinfo locinfo
;
266 pthreadmbcinfo mbcinfo
;
267 } _locale_tstruct
, *_locale_t
;
269 #ifndef _TAGLC_ID_DEFINED
270 typedef struct tagLC_ID
{
271 unsigned short wLanguage
;
272 unsigned short wCountry
;
273 unsigned short wCodePage
;
275 #define _TAGLC_ID_DEFINED
278 #ifndef _THREADLOCALEINFO
279 typedef struct threadlocaleinfostruct
{
280 #if _MSVCR_VER >= 140
281 unsigned short *pctype
;
283 unsigned int lc_codepage
;
288 unsigned int lc_codepage
;
290 unsigned int lc_collate_cp
;
291 __msvcrt_ulong lc_handle
[6];
303 int *lconv_intl_refcount
;
304 int *lconv_num_refcount
;
305 int *lconv_mon_refcount
;
307 int *ctype1_refcount
;
308 unsigned short *ctype1
;
310 unsigned short *pctype
;
312 const unsigned char *pclmap
;
313 const unsigned char *pcumap
;
314 struct __lc_time_data
*lc_time_curr
;
315 #if _MSVCR_VER >= 110
319 #define _THREADLOCALEINFO
322 #endif /* __WINE_CORECRT_H */