imm32: Delay import ole32.dll.
[wine.git] / include / msvcrt / corecrt.h
blobe61a22dccd797c56e48ca451d822ad7c0b072363
1 /*
2 * CRT definitions
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
26 #endif
28 #ifdef __WINE_CONFIG_H
29 # error You cannot use config.h with msvcrt
30 #endif
32 #ifndef _WIN32
33 # define _WIN32
34 #endif
36 #ifndef WIN32
37 # define WIN32
38 #endif
40 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
41 #define _WIN64
42 #endif
44 #ifndef _MSVCR_VER
45 # define _MSVCR_VER 140
46 #endif
48 #if !defined(_UCRT) && _MSVCR_VER >= 140
49 # define _UCRT
50 #endif
52 #include <sal.h>
54 #ifndef _MSC_VER
55 # ifndef __int8
56 # define __int8 char
57 # endif
58 # ifndef __int16
59 # define __int16 short
60 # endif
61 # ifndef __int32
62 # define __int32 int
63 # endif
64 # ifndef __int64
65 # if defined(_WIN64) && !defined(__MINGW64__)
66 # define __int64 long
67 # else
68 # define __int64 long long
69 # endif
70 # endif
71 #endif
73 #ifndef NULL
74 #ifdef __cplusplus
75 #define NULL 0
76 #else
77 #define NULL ((void *)0)
78 #endif
79 #endif
81 #ifndef __has_attribute
82 #define __has_attribute(x) 0
83 #endif
85 #ifndef _MSC_VER
86 # undef __stdcall
87 # ifdef __i386__
88 # ifdef __GNUC__
89 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
90 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
91 # else
92 # define __stdcall __attribute__((__stdcall__))
93 # endif
94 # else
95 # error You need to define __stdcall for your compiler
96 # endif
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__))
100 # else
101 # define __stdcall __attribute__((ms_abi))
102 # endif
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__ */
108 # define __stdcall
109 # endif /* __i386__ */
110 #endif /* __stdcall */
112 #ifndef _MSC_VER
113 # undef __cdecl
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__))
117 # else
118 # define __cdecl __attribute__((__cdecl__))
119 # endif
120 # else
121 # define __cdecl __stdcall
122 # endif
123 #endif
125 #if (defined(__x86_64__) || (defined(__aarch64__) && __has_attribute(ms_abi))) && defined (__GNUC__)
126 # include <stdarg.h>
127 # undef va_list
128 # undef va_start
129 # undef va_end
130 # undef va_copy
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)
135 #endif
137 #ifndef WINAPIV
138 # if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__) && !defined(__MINGW32__) && !defined(__CYGWIN__)
139 # define WINAPIV __attribute__((pcs("aapcs")))
140 # else
141 # define WINAPIV __cdecl
142 # endif
143 #endif
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))
150 # else
151 # define DECLSPEC_NORETURN
152 # endif
153 #endif
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)))
160 # else
161 # define DECLSPEC_ALIGN(x)
162 # endif
163 #endif
165 #ifndef _ACRTIMP
166 # ifdef _CRTIMP
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))
172 # else
173 # define _ACRTIMP
174 # endif
175 #endif
177 #define _ARGMAX 100
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 */
183 #ifdef __LP64__
184 typedef int __msvcrt_long;
185 typedef unsigned int __msvcrt_ulong;
186 #else
187 typedef long __msvcrt_long;
188 typedef unsigned long __msvcrt_ulong;
189 #endif
190 #endif
192 #ifndef _INTPTR_T_DEFINED
193 #ifdef _WIN64
194 typedef __int64 intptr_t;
195 #else
196 typedef int intptr_t;
197 #endif
198 #define _INTPTR_T_DEFINED
199 #endif
201 #ifndef _UINTPTR_T_DEFINED
202 #ifdef _WIN64
203 typedef unsigned __int64 uintptr_t;
204 #else
205 typedef unsigned int uintptr_t;
206 #endif
207 #define _UINTPTR_T_DEFINED
208 #endif
210 #ifndef _PTRDIFF_T_DEFINED
211 #ifdef _WIN64
212 typedef __int64 ptrdiff_t;
213 #else
214 typedef int ptrdiff_t;
215 #endif
216 #define _PTRDIFF_T_DEFINED
217 #endif
219 #ifndef _SIZE_T_DEFINED
220 #ifdef _WIN64
221 typedef unsigned __int64 size_t;
222 #else
223 typedef unsigned int size_t;
224 #endif
225 #define _SIZE_T_DEFINED
226 #endif
228 #ifndef _TIME32_T_DEFINED
229 typedef __msvcrt_long __time32_t;
230 #define _TIME32_T_DEFINED
231 #endif
233 #ifndef _TIME64_T_DEFINED
234 typedef __int64 DECLSPEC_ALIGN(8) __time64_t;
235 #define _TIME64_T_DEFINED
236 #endif
238 #ifdef _USE_32BIT_TIME_T
239 # ifdef _WIN64
240 # error You cannot use 32-bit time_t in Win64
241 # endif
242 #elif !defined(_WIN64)
243 # define _USE_32BIT_TIME_T
244 #endif
246 #ifndef _TIME_T_DEFINED
247 #ifdef _USE_32BIT_TIME_T
248 typedef __time32_t time_t;
249 #else
250 typedef __time64_t time_t;
251 #endif
252 #define _TIME_T_DEFINED
253 #endif
255 #ifndef _WCHAR_T_DEFINED
256 #ifndef __cplusplus
257 typedef unsigned short wchar_t;
258 #endif
259 #define _WCHAR_T_DEFINED
260 #endif
262 #ifndef _WCTYPE_T_DEFINED
263 typedef unsigned short wint_t;
264 typedef unsigned short wctype_t;
265 #define _WCTYPE_T_DEFINED
266 #endif
268 #ifndef _ERRNO_T_DEFINED
269 typedef int errno_t;
270 #define _ERRNO_T_DEFINED
271 #endif
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;
289 } LC_ID, *LPLC_ID;
290 #define _TAGLC_ID_DEFINED
291 #endif
293 #ifndef _THREADLOCALEINFO
294 typedef struct threadlocaleinfostruct {
295 #if _MSVCR_VER >= 140
296 unsigned short *pctype;
297 int mb_cur_max;
298 unsigned int lc_codepage;
299 #endif
301 int refcount;
302 #if _MSVCR_VER < 140
303 unsigned int lc_codepage;
304 #endif
305 unsigned int lc_collate_cp;
306 __msvcrt_ulong lc_handle[6];
307 LC_ID lc_id[6];
308 struct {
309 char *locale;
310 wchar_t *wlocale;
311 int *refcount;
312 int *wrefcount;
313 } lc_category[6];
314 int lc_clike;
315 #if _MSVCR_VER < 140
316 int mb_cur_max;
317 #endif
318 int *lconv_intl_refcount;
319 int *lconv_num_refcount;
320 int *lconv_mon_refcount;
321 struct lconv *lconv;
322 int *ctype1_refcount;
323 unsigned short *ctype1;
324 #if _MSVCR_VER < 140
325 unsigned short *pctype;
326 #endif
327 const unsigned char *pclmap;
328 const unsigned char *pcumap;
329 struct __lc_time_data *lc_time_curr;
330 #if _MSVCR_VER >= 110
331 wchar_t *lc_name[6];
332 #endif
333 } threadlocinfo;
334 #define _THREADLOCALEINFO
335 #endif
337 #endif /* __WINE_CORECRT_H */