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_CONFIG_H
29 # error You cannot use config.h with msvcrt
40 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
45 # define _MSVCR_VER 140
48 #if !defined(_UCRT) && _MSVCR_VER >= 140
59 # define __int16 short
65 # if defined(_WIN64) && !defined(__MINGW64__)
68 # define __int64 long long
77 #define NULL ((void *)0)
81 #ifndef __has_attribute
82 #define __has_attribute(x) 0
89 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
90 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
92 # define __stdcall __attribute__((__stdcall__))
95 # error You need to define __stdcall for your compiler
97 # elif defined(__x86_64__) && defined (__GNUC__)
98 # if __has_attribute(__force_align_arg_pointer__)
99 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
101 # define __stdcall __attribute__((ms_abi))
103 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
104 # define __stdcall __attribute__((pcs("aapcs-vfp")))
105 # elif defined(__aarch64__) && defined (__GNUC__) && __has_attribute(ms_abi)
106 # define __stdcall __attribute__((ms_abi))
107 # else /* __i386__ */
109 # endif /* __i386__ */
110 #endif /* __stdcall */
114 # if defined(__i386__) && defined(__GNUC__)
115 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
116 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
118 # define __cdecl __attribute__((__cdecl__))
121 # define __cdecl __stdcall
125 #if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__)
131 # define va_list __builtin_ms_va_list
132 # define va_start(list,arg) __builtin_ms_va_start(list,arg)
133 # define va_end(list) __builtin_ms_va_end(list)
134 # define va_copy(dest,src) __builtin_ms_va_copy(dest,src)
138 # if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
139 # define WINAPIV __attribute__((pcs("aapcs")))
141 # define WINAPIV __cdecl
145 #ifndef DECLSPEC_NORETURN
146 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
147 # define DECLSPEC_NORETURN __declspec(noreturn)
148 # elif defined(__GNUC__)
149 # define DECLSPEC_NORETURN __attribute__((noreturn))
151 # define DECLSPEC_NORETURN
155 #ifndef DECLSPEC_ALIGN
156 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
157 # define DECLSPEC_ALIGN(x) __declspec(align(x))
158 # elif defined(__GNUC__)
159 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
161 # define DECLSPEC_ALIGN(x)
167 # define _ACRTIMP _CRTIMP
168 # elif defined(_MSC_VER)
169 # define _ACRTIMP __declspec(dllimport)
170 # elif defined(__MINGW32__) || defined(__CYGWIN__)
171 # define _ACRTIMP __attribute__((dllimport))
178 #define _CRT_INT_MAX 0x7fffffff
180 #ifndef _MSVCRT_LONG_DEFINED
181 #define _MSVCRT_LONG_DEFINED
182 /* we need 32-bit longs even on 64-bit */
184 typedef int __msvcrt_long
;
185 typedef unsigned int __msvcrt_ulong
;
187 typedef long __msvcrt_long
;
188 typedef unsigned long __msvcrt_ulong
;
192 #ifndef _INTPTR_T_DEFINED
194 typedef __int64
intptr_t;
196 typedef int intptr_t;
198 #define _INTPTR_T_DEFINED
201 #ifndef _UINTPTR_T_DEFINED
203 typedef unsigned __int64
uintptr_t;
205 typedef unsigned int uintptr_t;
207 #define _UINTPTR_T_DEFINED
210 #ifndef _PTRDIFF_T_DEFINED
212 typedef __int64
ptrdiff_t;
214 typedef int ptrdiff_t;
216 #define _PTRDIFF_T_DEFINED
219 #ifndef _SIZE_T_DEFINED
221 typedef unsigned __int64
size_t;
223 typedef unsigned int size_t;
225 #define _SIZE_T_DEFINED
228 #ifndef _TIME32_T_DEFINED
229 typedef __msvcrt_long __time32_t
;
230 #define _TIME32_T_DEFINED
233 #ifndef _TIME64_T_DEFINED
234 typedef __int64
DECLSPEC_ALIGN(8) __time64_t
;
235 #define _TIME64_T_DEFINED
238 #ifdef _USE_32BIT_TIME_T
240 # error You cannot use 32-bit time_t in Win64
242 #elif !defined(_WIN64)
243 # define _USE_32BIT_TIME_T
246 #ifndef _TIME_T_DEFINED
247 #ifdef _USE_32BIT_TIME_T
248 typedef __time32_t
time_t;
250 typedef __time64_t
time_t;
252 #define _TIME_T_DEFINED
255 #ifndef _WCHAR_T_DEFINED
257 typedef unsigned short wchar_t;
259 #define _WCHAR_T_DEFINED
262 #ifndef _WCTYPE_T_DEFINED
263 typedef unsigned short wint_t;
264 typedef unsigned short wctype_t;
265 #define _WCTYPE_T_DEFINED
268 #ifndef _ERRNO_T_DEFINED
270 #define _ERRNO_T_DEFINED
273 struct threadlocaleinfostruct
;
274 struct threadmbcinfostruct
;
275 typedef struct threadlocaleinfostruct
*pthreadlocinfo
;
276 typedef struct threadmbcinfostruct
*pthreadmbcinfo
;
278 typedef struct localeinfo_struct
280 pthreadlocinfo locinfo
;
281 pthreadmbcinfo mbcinfo
;
282 } _locale_tstruct
, *_locale_t
;
284 #ifndef _TAGLC_ID_DEFINED
285 typedef struct tagLC_ID
{
286 unsigned short wLanguage
;
287 unsigned short wCountry
;
288 unsigned short wCodePage
;
290 #define _TAGLC_ID_DEFINED
293 #ifndef _THREADLOCALEINFO
294 typedef struct threadlocaleinfostruct
{
295 #if _MSVCR_VER >= 140
296 unsigned short *pctype
;
298 unsigned int lc_codepage
;
303 unsigned int lc_codepage
;
305 unsigned int lc_collate_cp
;
306 __msvcrt_ulong lc_handle
[6];
318 int *lconv_intl_refcount
;
319 int *lconv_num_refcount
;
320 int *lconv_mon_refcount
;
322 int *ctype1_refcount
;
323 unsigned short *ctype1
;
325 unsigned short *pctype
;
327 const unsigned char *pclmap
;
328 const unsigned char *pcumap
;
329 struct __lc_time_data
*lc_time_curr
;
330 #if _MSVCR_VER >= 110
334 #define _THREADLOCALEINFO
337 #if !defined(__WINE_USE_MSVCRT) || defined(__MINGW32__)
338 #define __WINE_CRT_PRINTF_ATTR(fmt,args) __attribute__((format (printf,fmt,args)))
339 #define __WINE_CRT_SCANF_ATTR(fmt,args) __attribute__((format (scanf,fmt,args)))
341 #define __WINE_CRT_PRINTF_ATTR(fmt,args)
342 #define __WINE_CRT_SCANF_ATTR(fmt,args)
345 #endif /* __WINE_CORECRT_H */