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)
36 #if !defined(_MSC_VER) && !defined(__int64)
37 # if defined(_WIN64) && !defined(__MINGW64__)
40 # define __int64 long long
48 #define NULL ((void *)0)
52 #if !defined(_MSC_VER) && !defined(__stdcall)
55 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
56 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
58 # define __stdcall __attribute__((__stdcall__))
61 # error You need to define __stdcall for your compiler
63 # elif defined(__x86_64__) && defined (__GNUC__)
64 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
65 # define __stdcall __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
67 # define __stdcall __attribute__((ms_abi))
69 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
70 # define __stdcall __attribute__((pcs("aapcs-vfp")))
71 # elif defined(__aarch64__) && defined (__GNUC__)
72 # define __stdcall __attribute__((ms_abi))
75 # endif /* __i386__ */
76 #endif /* __stdcall */
78 #if !defined(_MSC_VER) && !defined(__cdecl)
79 # if defined(__i386__) && defined(__GNUC__)
80 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
81 # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
83 # define __cdecl __attribute__((__cdecl__))
85 # elif defined(__x86_64__) && defined (__GNUC__)
86 # if (__GNUC__ > 5) || ((__GNUC__ == 5) && (__GNUC_MINOR__ >= 3))
87 # define __cdecl __attribute__((ms_abi)) __attribute__((__force_align_arg_pointer__))
89 # define __cdecl __attribute__((ms_abi))
91 # elif defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
92 # define __cdecl __attribute__((pcs("aapcs-vfp")))
93 # elif defined(__aarch64__) && defined (__GNUC__)
94 # define __cdecl __attribute__((ms_abi))
99 # if (defined(__x86_64__) || defined(__aarch64__)) && defined (__GNUC__)
100 # define __ms_va_list __builtin_ms_va_list
101 # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
102 # define __ms_va_end(list) __builtin_ms_va_end(list)
103 # define __ms_va_copy(dest,src) __builtin_ms_va_copy(dest,src)
105 # define __ms_va_list va_list
106 # define __ms_va_start(list,arg) va_start(list,arg)
107 # define __ms_va_end(list) va_end(list)
109 # define __ms_va_copy(dest,src) va_copy(dest,src)
111 # define __ms_va_copy(dest,src) ((dest) = (src))
117 # if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
118 # define WINAPIV __attribute__((pcs("aapcs")))
120 # define WINAPIV __cdecl
124 #ifndef DECLSPEC_NORETURN
125 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
126 # define DECLSPEC_NORETURN __declspec(noreturn)
127 # elif defined(__GNUC__)
128 # define DECLSPEC_NORETURN __attribute__((noreturn))
130 # define DECLSPEC_NORETURN
134 #ifndef DECLSPEC_ALIGN
135 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
136 # define DECLSPEC_ALIGN(x) __declspec(align(x))
137 # elif defined(__GNUC__)
138 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
140 # define DECLSPEC_ALIGN(x)
146 # define _ACRTIMP _CRTIMP
147 # elif defined(_MSC_VER)
148 # define _ACRTIMP __declspec(dllimport)
149 # elif defined(__MINGW32__) || defined(__CYGWIN__)
150 # define _ACRTIMP __attribute__((dllimport))
157 #define _CRT_INT_MAX 0x7fffffff
159 #ifndef _MSVCRT_LONG_DEFINED
160 #define _MSVCRT_LONG_DEFINED
161 /* we need 32-bit longs even on 64-bit */
163 typedef int __msvcrt_long
;
164 typedef unsigned int __msvcrt_ulong
;
166 typedef long __msvcrt_long
;
167 typedef unsigned long __msvcrt_ulong
;
171 #ifndef _INTPTR_T_DEFINED
173 typedef __int64
intptr_t;
175 typedef int intptr_t;
177 #define _INTPTR_T_DEFINED
180 #ifndef _UINTPTR_T_DEFINED
182 typedef unsigned __int64
uintptr_t;
184 typedef unsigned int uintptr_t;
186 #define _UINTPTR_T_DEFINED
189 #ifndef _PTRDIFF_T_DEFINED
191 typedef __int64
ptrdiff_t;
193 typedef int ptrdiff_t;
195 #define _PTRDIFF_T_DEFINED
198 #ifndef _SIZE_T_DEFINED
200 typedef unsigned __int64
size_t;
202 typedef unsigned int size_t;
204 #define _SIZE_T_DEFINED
207 #ifndef _TIME32_T_DEFINED
208 typedef __msvcrt_long __time32_t
;
209 #define _TIME32_T_DEFINED
212 #ifndef _TIME64_T_DEFINED
213 typedef __int64
DECLSPEC_ALIGN(8) __time64_t
;
214 #define _TIME64_T_DEFINED
217 #ifdef _USE_32BIT_TIME_T
219 # error You cannot use 32-bit time_t in Win64
221 #elif !defined(_WIN64)
222 # define _USE_32BIT_TIME_T
225 #ifndef _TIME_T_DEFINED
226 #ifdef _USE_32BIT_TIME_T
227 typedef __time32_t
time_t;
229 typedef __time64_t
time_t;
231 #define _TIME_T_DEFINED
234 #ifndef _WCHAR_T_DEFINED
236 typedef unsigned short wchar_t;
238 #define _WCHAR_T_DEFINED
241 #ifndef _WCTYPE_T_DEFINED
242 typedef unsigned short wint_t;
243 typedef unsigned short wctype_t;
244 #define _WCTYPE_T_DEFINED
247 #ifndef _ERRNO_T_DEFINED
249 #define _ERRNO_T_DEFINED
252 struct threadlocaleinfostruct
;
253 struct threadmbcinfostruct
;
254 typedef struct threadlocaleinfostruct
*pthreadlocinfo
;
255 typedef struct threadmbcinfostruct
*pthreadmbcinfo
;
257 typedef struct localeinfo_struct
259 pthreadlocinfo locinfo
;
260 pthreadmbcinfo mbcinfo
;
261 } _locale_tstruct
, *_locale_t
;
263 #ifndef _TAGLC_ID_DEFINED
264 typedef struct tagLC_ID
{
265 unsigned short wLanguage
;
266 unsigned short wCountry
;
267 unsigned short wCodePage
;
269 #define _TAGLC_ID_DEFINED
272 #ifndef _THREADLOCALEINFO
273 typedef struct threadlocaleinfostruct
{
275 unsigned int lc_codepage
;
276 unsigned int lc_collate_cp
;
277 __msvcrt_ulong lc_handle
[6];
287 int *lconv_intl_refcount
;
288 int *lconv_num_refcount
;
289 int *lconv_mon_refcount
;
291 int *ctype1_refcount
;
292 unsigned short *ctype1
;
293 const unsigned short *pctype
;
294 const unsigned char *pclmap
;
295 const unsigned char *pcumap
;
296 struct __lc_time_data
*lc_time_curr
;
298 #define _THREADLOCALEINFO
301 #endif /* __WINE_CORECRT_H */