ntdll: Initialize server directory on macOS when sending Mach port.
[wine.git] / include / msvcrt / corecrt.h
blobbc93de023f2b7580189b095bb54219d5ac15d2da
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_WINE_PORT_H
29 # error You cannot use both wine/port.h and msvcrt headers
30 #endif
32 #if (defined(__x86_64__) || defined(__powerpc64__) || defined(__aarch64__)) && !defined(_WIN64)
33 #define _WIN64
34 #endif
36 #if !defined(_MSC_VER) && !defined(__int64)
37 # if defined(_WIN64) && !defined(__MINGW64__)
38 # define __int64 long
39 # else
40 # define __int64 long long
41 # endif
42 #endif
44 #ifndef NULL
45 #ifdef __cplusplus
46 #define NULL 0
47 #else
48 #define NULL ((void *)0)
49 #endif
50 #endif
52 #if !defined(_MSC_VER) && !defined(__stdcall)
53 # ifdef __i386__
54 # ifdef __GNUC__
55 # if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)) || defined(__APPLE__)
56 # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
57 # else
58 # define __stdcall __attribute__((__stdcall__))
59 # endif
60 # else
61 # error You need to define __stdcall for your compiler
62 # endif
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__))
66 # else
67 # define __stdcall __attribute__((ms_abi))
68 # endif
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))
73 # else /* __i386__ */
74 # define __stdcall
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__))
82 # else
83 # define __cdecl __attribute__((__cdecl__))
84 # endif
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__))
88 # else
89 # define __cdecl __attribute__((ms_abi))
90 # endif
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))
95 # endif
96 #endif /* __cdecl */
98 #ifndef __ms_va_list
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)
104 # else
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)
108 # ifdef va_copy
109 # define __ms_va_copy(dest,src) va_copy(dest,src)
110 # else
111 # define __ms_va_copy(dest,src) ((dest) = (src))
112 # endif
113 # endif
114 #endif
116 #ifndef WINAPIV
117 # if defined(__arm__) && defined (__GNUC__) && !defined(__SOFTFP__)
118 # define WINAPIV __attribute__((pcs("aapcs")))
119 # else
120 # define WINAPIV __cdecl
121 # endif
122 #endif
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))
129 # else
130 # define DECLSPEC_NORETURN
131 # endif
132 #endif
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)))
139 # else
140 # define DECLSPEC_ALIGN(x)
141 # endif
142 #endif
144 #ifndef _ACRTIMP
145 # ifdef _CRTIMP
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))
151 # else
152 # define _ACRTIMP
153 # endif
154 #endif
156 #define _ARGMAX 100
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 */
162 #ifdef __LP64__
163 typedef int __msvcrt_long;
164 typedef unsigned int __msvcrt_ulong;
165 #else
166 typedef long __msvcrt_long;
167 typedef unsigned long __msvcrt_ulong;
168 #endif
169 #endif
171 #ifndef _INTPTR_T_DEFINED
172 #ifdef _WIN64
173 typedef __int64 intptr_t;
174 #else
175 typedef int intptr_t;
176 #endif
177 #define _INTPTR_T_DEFINED
178 #endif
180 #ifndef _UINTPTR_T_DEFINED
181 #ifdef _WIN64
182 typedef unsigned __int64 uintptr_t;
183 #else
184 typedef unsigned int uintptr_t;
185 #endif
186 #define _UINTPTR_T_DEFINED
187 #endif
189 #ifndef _PTRDIFF_T_DEFINED
190 #ifdef _WIN64
191 typedef __int64 ptrdiff_t;
192 #else
193 typedef int ptrdiff_t;
194 #endif
195 #define _PTRDIFF_T_DEFINED
196 #endif
198 #ifndef _SIZE_T_DEFINED
199 #ifdef _WIN64
200 typedef unsigned __int64 size_t;
201 #else
202 typedef unsigned int size_t;
203 #endif
204 #define _SIZE_T_DEFINED
205 #endif
207 #ifndef _TIME32_T_DEFINED
208 typedef __msvcrt_long __time32_t;
209 #define _TIME32_T_DEFINED
210 #endif
212 #ifndef _TIME64_T_DEFINED
213 typedef __int64 DECLSPEC_ALIGN(8) __time64_t;
214 #define _TIME64_T_DEFINED
215 #endif
217 #ifdef _USE_32BIT_TIME_T
218 # ifdef _WIN64
219 # error You cannot use 32-bit time_t in Win64
220 # endif
221 #elif !defined(_WIN64)
222 # define _USE_32BIT_TIME_T
223 #endif
225 #ifndef _TIME_T_DEFINED
226 #ifdef _USE_32BIT_TIME_T
227 typedef __time32_t time_t;
228 #else
229 typedef __time64_t time_t;
230 #endif
231 #define _TIME_T_DEFINED
232 #endif
234 #ifndef _WCHAR_T_DEFINED
235 #ifndef __cplusplus
236 typedef unsigned short wchar_t;
237 #endif
238 #define _WCHAR_T_DEFINED
239 #endif
241 #ifndef _WCTYPE_T_DEFINED
242 typedef unsigned short wint_t;
243 typedef unsigned short wctype_t;
244 #define _WCTYPE_T_DEFINED
245 #endif
247 #ifndef _ERRNO_T_DEFINED
248 typedef int errno_t;
249 #define _ERRNO_T_DEFINED
250 #endif
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;
268 } LC_ID, *LPLC_ID;
269 #define _TAGLC_ID_DEFINED
270 #endif
272 #ifndef _THREADLOCALEINFO
273 typedef struct threadlocaleinfostruct {
274 int refcount;
275 unsigned int lc_codepage;
276 unsigned int lc_collate_cp;
277 __msvcrt_ulong lc_handle[6];
278 LC_ID lc_id[6];
279 struct {
280 char *locale;
281 wchar_t *wlocale;
282 int *refcount;
283 int *wrefcount;
284 } lc_category[6];
285 int lc_clike;
286 int mb_cur_max;
287 int *lconv_intl_refcount;
288 int *lconv_num_refcount;
289 int *lconv_mon_refcount;
290 struct lconv *lconv;
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;
297 } threadlocinfo;
298 #define _THREADLOCALEINFO
299 #endif
301 #endif /* __WINE_CORECRT_H */