• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * This file has no copyright assigned and is placed in the Public Domain.
3  * This file is part of the mingw-w64 runtime package.
4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
5  */
6 #ifndef _INC_STDLIB
7 #define _INC_STDLIB
8 
9 #include <corecrt.h>
10 #include <corecrt_wstdlib.h>
11 #include <limits.h>
12 
13 #if __USE_MINGW_ANSI_STDIO && !defined (__USE_MINGW_STRTOX)
14 #define __USE_MINGW_STRTOX 1
15 #endif
16 
17 #if defined(__LIBMSVCRT__)
18 /* When building mingw-w64, this should be blank.  */
19 #define _SECIMP
20 #else
21 #ifndef _SECIMP
22 #define _SECIMP __declspec(dllimport)
23 #endif /* _SECIMP */
24 #endif /* defined(_CRTBLD) || defined(__LIBMSVCRT__) */
25 
26 #pragma pack(push,_CRT_PACKING)
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #ifndef NULL
33 #ifdef __cplusplus
34 #ifndef _WIN64
35 #define NULL 0
36 #else
37 #define NULL 0LL
38 #endif  /* W64 */
39 #else
40 #define NULL ((void *)0)
41 #endif
42 #endif
43 
44 #define EXIT_SUCCESS 0
45 #define EXIT_FAILURE 1
46 
47 #ifndef _ONEXIT_T_DEFINED
48 #define _ONEXIT_T_DEFINED
49 
50   typedef int (__cdecl *_onexit_t)(void);
51 
52 #ifndef	NO_OLDNAMES
53 #define onexit_t _onexit_t
54 #endif
55 #endif
56 
57 #ifndef _DIV_T_DEFINED
58 #define _DIV_T_DEFINED
59 
60   typedef struct _div_t {
61     int quot;
62     int rem;
63   } div_t;
64 
65   typedef struct _ldiv_t {
66     long quot;
67     long rem;
68   } ldiv_t;
69 #endif
70 
71 #ifndef _CRT_DOUBLE_DEC
72 #define _CRT_DOUBLE_DEC
73 
74 #pragma pack(4)
75   typedef struct {
76     unsigned char ld[10];
77   } _LDOUBLE;
78 #pragma pack()
79 
80 #define _PTR_LD(x) ((unsigned char *)(&(x)->ld))
81 
82   typedef struct {
83     double x;
84   } _CRT_DOUBLE;
85 
86   typedef struct {
87     float f;
88   } _CRT_FLOAT;
89 
90 #pragma push_macro("long")
91 #undef long
92 
93   typedef struct {
94     long double x;
95   } _LONGDOUBLE;
96 
97 #pragma pop_macro("long")
98 
99 #pragma pack(4)
100   typedef struct {
101     unsigned char ld12[12];
102   } _LDBL12;
103 #pragma pack()
104 #endif
105 
106 #define RAND_MAX 0x7fff
107 
108 #ifndef MB_CUR_MAX
109 #define MB_CUR_MAX ___mb_cur_max_func()
110 #ifndef __mb_cur_max
111 #ifdef _MSVCRT_
112   extern int __mb_cur_max;
113 #define __mb_cur_max	__mb_cur_max
114 #else
115 #ifndef _UCRT
116   extern int * __MINGW_IMP_SYMBOL(__mb_cur_max);
117 #endif
118 #define __mb_cur_max	(___mb_cur_max_func())
119 #endif
120 #endif
121 _CRTIMP int __cdecl ___mb_cur_max_func(void);
122 #endif
123 
124 #define __max(a,b) (((a) > (b)) ? (a) : (b))
125 #define __min(a,b) (((a) < (b)) ? (a) : (b))
126 
127 #define _MAX_PATH 260
128 #define _MAX_DRIVE 3
129 #define _MAX_DIR 256
130 #define _MAX_FNAME 256
131 #define _MAX_EXT 256
132 
133 #define _OUT_TO_DEFAULT 0
134 #define _OUT_TO_STDERR 1
135 #define _OUT_TO_MSGBOX 2
136 #define _REPORT_ERRMODE 3
137 
138 #define _WRITE_ABORT_MSG 0x1
139 #define _CALL_REPORTFAULT 0x2
140 
141 #define _MAX_ENV 32767
142 
143   typedef void (__cdecl *_purecall_handler)(void);
144 
145   _CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler);
146   _CRTIMP _purecall_handler __cdecl _get_purecall_handler(void);
147 
148   typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t);
149   _CRTIMP _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
150   _CRTIMP _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
151 
152 #ifndef _CRT_ERRNO_DEFINED
153 #define _CRT_ERRNO_DEFINED
154   _CRTIMP extern int *__cdecl _errno(void);
155 #define errno (*_errno())
156   errno_t __cdecl _set_errno(int _Value);
157   errno_t __cdecl _get_errno(int *_Value);
158 #endif
159   _CRTIMP unsigned long *__cdecl __doserrno(void);
160 #define _doserrno (*__doserrno())
161   errno_t __cdecl _set_doserrno(unsigned long _Value);
162   errno_t __cdecl _get_doserrno(unsigned long *_Value);
163 #ifdef _MSVCRT_
164   extern char *_sys_errlist[];
165   extern int _sys_nerr;
166 #else
167 #ifdef _UCRT
168   _CRTIMP char **__cdecl __sys_errlist(void);
169   _CRTIMP int *__cdecl __sys_nerr(void);
170 #define _sys_nerr (*__sys_nerr())
171 #define _sys_errlist (__sys_errlist())
172 #else
173   extern __declspec(dllimport) char *_sys_errlist[1];
174   extern __declspec(dllimport) int _sys_nerr;
175 #endif /* !_UCRT */
176 #endif
177 
178   /* We have a fallback definition of __p___argv and __p__fmode for
179      msvcrt versions that lack it. */
180   _CRTIMP char ***__cdecl __p___argv(void);
181   _CRTIMP int *__cdecl __p__fmode(void);
182 #if (defined(_X86_) && !defined(__x86_64)) || defined(_UCRT)
183   _CRTIMP int *__cdecl __p___argc(void);
184   _CRTIMP wchar_t ***__cdecl __p___wargv(void);
185   _CRTIMP char ***__cdecl __p__environ(void);
186   _CRTIMP wchar_t ***__cdecl __p__wenviron(void);
187   _CRTIMP char **__cdecl __p__pgmptr(void);
188   _CRTIMP wchar_t **__cdecl __p__wpgmptr(void);
189 #endif
190 
191   errno_t __cdecl _get_pgmptr(char **_Value);
192   errno_t __cdecl _get_wpgmptr(wchar_t **_Value);
193   _CRTIMP errno_t __cdecl _set_fmode(int _Mode);
194   _CRTIMP errno_t __cdecl _get_fmode(int *_PMode);
195 
196 #ifndef _fmode
197 #define _fmode (* __p__fmode())
198 #endif
199 
200 #ifdef _MSVCRT_
201 
202 #ifndef __argc
203   extern int __argc;
204 #endif
205 #ifndef __argv
206   extern char **__argv;
207 #endif
208 #ifndef __wargv
209   extern wchar_t **__wargv;
210 #endif
211 
212 #ifndef _POSIX_
213 #ifndef _environ
214   extern char **_environ;
215 #endif
216 #ifndef _wenviron
217   extern wchar_t **_wenviron;
218 #endif
219 #endif /* !_POSIX_ */
220 
221 #ifndef _pgmptr
222   extern char *_pgmptr;
223 #endif
224 
225 #ifndef _wpgmptr
226   extern wchar_t *_wpgmptr;
227 #endif
228 
229 #ifndef _osplatform
230   extern unsigned int _osplatform;
231 #endif
232 
233 #ifndef _osver
234   extern unsigned int _osver;
235 #endif
236 
237 #ifndef _winver
238   extern unsigned int _winver;
239 #endif
240 
241 #ifndef _winmajor
242   extern unsigned int _winmajor;
243 #endif
244 
245 #ifndef _winminor
246   extern unsigned int _winminor;
247 #endif
248 
249 #elif defined(_UCRT)
250 
251 #ifndef __argc
252 #define __argc (* __p___argc())
253 #endif
254 #ifndef __argv
255 #define __argv (* __p___argv())
256 #endif
257 #ifndef __wargv
258 #define __wargv (* __p___wargv())
259 #endif
260 
261 #ifndef _POSIX_
262 #ifndef _environ
263 #define _environ (* __p__environ())
264 #endif
265 
266 #ifndef _wenviron
267 #define _wenviron (* __p__wenviron())
268 #endif
269 #endif /* !_POSIX_ */
270 
271 #ifndef _pgmptr
272 #define _pgmptr (* __p__pgmptr())
273 #endif
274 
275 #ifndef _wpgmptr
276 #define _wpgmptr (* __p__wpgmptr())
277 #endif
278 
279 #else /* _UCRT */
280 
281 #ifndef __argc
282   extern int * __MINGW_IMP_SYMBOL(__argc);
283 #define __argc (* __MINGW_IMP_SYMBOL(__argc))
284 #endif
285 #ifndef __argv
286   extern char *** __MINGW_IMP_SYMBOL(__argv);
287 #define __argv	(* __p___argv())
288 #endif
289 #ifndef __wargv
290   extern wchar_t *** __MINGW_IMP_SYMBOL(__wargv);
291 #define __wargv (* __MINGW_IMP_SYMBOL(__wargv))
292 #endif
293 
294 #ifndef _POSIX_
295 #if (defined(_ARM_) || defined(__arm__) || defined(_ARM64_) || defined(__aarch64__))
296   /* The plain msvcrt.dll for arm/aarch64 (and msvcr120_app.dll for arm) lacks
297    * _environ/_wenviron, but has these functions instead. */
298   _CRTIMP void __cdecl _get_environ(char ***);
299   _CRTIMP void __cdecl _get_wenviron(wchar_t ***);
300 
__get_environ_ptr(void)301   static __inline char **__get_environ_ptr(void) {
302     char **__ptr;
303     _get_environ(&__ptr);
304     return __ptr;
305   }
306 
__get_wenviron_ptr(void)307   static __inline wchar_t **__get_wenviron_ptr(void) {
308     wchar_t **__ptr;
309     _get_wenviron(&__ptr);
310     return __ptr;
311   }
312 
313 #ifndef _environ
314 #define _environ (__get_environ_ptr())
315 #endif
316 
317 #ifndef _wenviron
318 #define _wenviron (__get_wenviron_ptr())
319 #endif
320 #else /* ARM/ARM64 */
321 #ifndef _environ
322   extern char *** __MINGW_IMP_SYMBOL(_environ);
323 #define _environ (* __MINGW_IMP_SYMBOL(_environ))
324 #endif
325 
326 #ifndef _wenviron
327   extern wchar_t *** __MINGW_IMP_SYMBOL(_wenviron);
328 #define _wenviron (* __MINGW_IMP_SYMBOL(_wenviron))
329 #endif
330 #endif /* !ARM/ARM64 */
331 #endif /* !_POSIX_ */
332 
333 #ifndef _pgmptr
334   extern char ** __MINGW_IMP_SYMBOL(_pgmptr);
335 #define _pgmptr	(* __MINGW_IMP_SYMBOL(_pgmptr))
336 #endif
337 
338 #ifndef _wpgmptr
339   extern wchar_t ** __MINGW_IMP_SYMBOL(_wpgmptr);
340 #define _wpgmptr (* __MINGW_IMP_SYMBOL(_wpgmptr))
341 #endif
342 
343 #ifndef _osplatform
344   extern unsigned int * __MINGW_IMP_SYMBOL(_osplatform);
345 #define _osplatform (* __MINGW_IMP_SYMBOL(_osplatform))
346 #endif
347 
348 #ifndef _osver
349   extern unsigned int * __MINGW_IMP_SYMBOL(_osver);
350 #define _osver	(* __MINGW_IMP_SYMBOL(_osver))
351 #endif
352 
353 #ifndef _winver
354   extern unsigned int * __MINGW_IMP_SYMBOL(_winver);
355 #define _winver	(* __MINGW_IMP_SYMBOL(_winver))
356 #endif
357 
358 #ifndef _winmajor
359   extern unsigned int * __MINGW_IMP_SYMBOL(_winmajor);
360 #define _winmajor (* __MINGW_IMP_SYMBOL(_winmajor))
361 #endif
362 
363 #ifndef _winminor
364   extern unsigned int * __MINGW_IMP_SYMBOL(_winminor);
365 #define _winminor (* __MINGW_IMP_SYMBOL(_winminor))
366 #endif
367 
368 #endif /* !_MSVCRT_ && !_UCRT */
369 
370   errno_t __cdecl _get_osplatform(unsigned int *_Value);
371   errno_t __cdecl _get_osver(unsigned int *_Value);
372   errno_t __cdecl _get_winver(unsigned int *_Value);
373   errno_t __cdecl _get_winmajor(unsigned int *_Value);
374   errno_t __cdecl _get_winminor(unsigned int *_Value);
375 #ifndef _countof
376 #ifndef __cplusplus
377 #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
378 #else
379   extern "C++" {
380     template <typename _CountofType,size_t _SizeOfArray> char (*__countof_helper(UNALIGNED _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
381 #define _countof(_Array) sizeof(*__countof_helper(_Array))
382   }
383 #endif
384 #endif
385 
386 #ifndef _CRT_TERMINATE_DEFINED
387 #define _CRT_TERMINATE_DEFINED
388   void __cdecl __MINGW_NOTHROW exit(int _Code) __MINGW_ATTRIB_NORETURN;
389   void __cdecl __MINGW_NOTHROW _exit(int _Code) __MINGW_ATTRIB_NORETURN;
390 
391 #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
392   /* C99 function name */
393   void __cdecl _Exit(int) __MINGW_ATTRIB_NORETURN;
394 #ifndef __CRT__NO_INLINE
_Exit(int status)395   __CRT_INLINE __MINGW_ATTRIB_NORETURN void  __cdecl _Exit(int status)
396   {  _exit(status); }
397 #endif /* !__CRT__NO_INLINE */
398 #endif /* Not  __NO_ISOCEXT */
399 
400 #pragma push_macro("abort")
401 #undef abort
402   void __cdecl __MINGW_ATTRIB_NORETURN abort(void);
403 #pragma pop_macro("abort")
404 
405 #endif /* _CRT_TERMINATE_DEFINED */
406 
407   _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask);
408 
409 #ifndef _CRT_ABS_DEFINED
410 #define _CRT_ABS_DEFINED
411   int __cdecl abs(int _X);
412   long __cdecl labs(long _X);
413 #endif
414 
415   __MINGW_EXTENSION __int64 __cdecl _abs64(__int64);
416 #ifdef __MINGW_INTRIN_INLINE
_abs64(__int64 x)417   __MINGW_INTRIN_INLINE __int64 __cdecl _abs64(__int64 x) {
418     return __builtin_llabs(x);
419   }
420 #endif
421 
422   int __cdecl atexit(void (__cdecl *)(void));
423 #ifndef _CRT_ATOF_DEFINED
424 #define _CRT_ATOF_DEFINED
425   double __cdecl atof(const char *_String);
426   double __cdecl _atof_l(const char *_String,_locale_t _Locale);
427 #endif
428   int __cdecl atoi(const char *_Str);
429   _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale);
430   long __cdecl atol(const char *_Str);
431   _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale);
432 #ifndef _CRT_ALGO_DEFINED
433 #define _CRT_ALGO_DEFINED
434   void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
435   void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
436 #endif
437   unsigned short __cdecl _byteswap_ushort(unsigned short _Short);
438   unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
439   __MINGW_EXTENSION unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64);
440   div_t __cdecl div(int _Numerator,int _Denominator);
441   char *__cdecl getenv(const char *_VarName) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
442   _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix);
443   __MINGW_EXTENSION _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
444   __MINGW_EXTENSION _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
445   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _atoi64(const char *_String);
446   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale);
447   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix);
448   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
449   __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix);
450   __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
451   ldiv_t __cdecl ldiv(long _Numerator,long _Denominator);
452   _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
453   int __cdecl mblen(const char *_Ch,size_t _MaxCount);
454   _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale);
455   _CRTIMP size_t __cdecl _mbstrlen(const char *_Str);
456   _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale);
457   _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount);
458   _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale);
459   int __cdecl mbtowc(wchar_t * __restrict__ _DstCh,const char * __restrict__ _SrcCh,size_t _SrcSizeInBytes);
460   _CRTIMP int __cdecl _mbtowc_l(wchar_t * __restrict__ _DstCh,const char * __restrict__ _SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale);
461   size_t __cdecl mbstowcs(wchar_t * __restrict__ _Dest,const char * __restrict__ _Source,size_t _MaxCount);
462   _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t * __restrict__ _Dest,const char * __restrict__ _Source,size_t _MaxCount,_locale_t _Locale);
463   int __cdecl mkstemp(char *template_name);
464   int __cdecl rand(void);
465   _CRTIMP int __cdecl _set_error_mode(int _Mode);
466   void __cdecl srand(unsigned int _Seed);
467 #if defined(_POSIX) || defined(_POSIX_THREAD_SAFE_FUNCTIONS)
468   #ifndef rand_r
469   #define rand_r(__seed) (__seed == __seed ? rand () : rand ())
470   #endif
471 #endif
472 #ifdef _CRT_RAND_S
473   _SECIMP errno_t __cdecl rand_s(unsigned int *randomValue);
474 #endif
475 
476 #if defined(__USE_MINGW_STRTOX)
477 __mingw_ovr
strtod(const char * __restrict__ _Str,char ** __restrict__ _EndPtr)478 double __cdecl __MINGW_NOTHROW strtod(const char * __restrict__ _Str,char ** __restrict__ _EndPtr)
479 {
480   double __cdecl __mingw_strtod (const char * __restrict__, char ** __restrict__);
481   return __mingw_strtod( _Str, _EndPtr);
482 }
483 
484 __mingw_ovr
strtof(const char * __restrict__ _Str,char ** __restrict__ _EndPtr)485 float __cdecl __MINGW_NOTHROW strtof(const char * __restrict__ _Str,char ** __restrict__ _EndPtr)
486 {
487   float __cdecl __mingw_strtof (const char * __restrict__, char ** __restrict__);
488   return __mingw_strtof( _Str, _EndPtr);
489 }
490 
491 /* strtold is already an alias to __mingw_strtold */
492 #else
493   double __cdecl __MINGW_NOTHROW strtod(const char * __restrict__ _Str,char ** __restrict__ _EndPtr);
494   float __cdecl __MINGW_NOTHROW strtof(const char * __restrict__ nptr, char ** __restrict__ endptr);
495 #endif /* defined(__USE_MINGW_STRTOX) */
496   long double __cdecl __MINGW_NOTHROW strtold(const char * __restrict__ , char ** __restrict__ );
497 #if !defined __NO_ISOCEXT
498   /* libmingwex.a provides a c99-compliant strtod() exported as __strtod() */
499   extern double __cdecl __MINGW_NOTHROW
500   __strtod (const char * __restrict__ , char ** __restrict__);
501 // The UCRT version of strtod is C99 compliant, so we don't need to redirect it to the mingw version.
502 #if !defined(__USE_MINGW_STRTOX) && !defined(_UCRT)
503 #define strtod __strtod
504 #endif /* !defined(__USE_MINGW_STRTOX) */
505 #endif /* __NO_ISOCEXT */
506 
507 #if !defined __NO_ISOCEXT  /* in libmingwex.a */
508   float __cdecl __mingw_strtof (const char * __restrict__, char ** __restrict__);
509   double __cdecl __mingw_strtod (const char * __restrict__, char ** __restrict__);
510   long double __cdecl __mingw_strtold(const char * __restrict__, char ** __restrict__);
511 #endif /* __NO_ISOCEXT */
512   _CRTIMP double __cdecl _strtod_l(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,_locale_t _Locale);
513   long __cdecl strtol(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix);
514   _CRTIMP long __cdecl _strtol_l(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
515   unsigned long __cdecl strtoul(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix);
516   _CRTIMP unsigned long __cdecl _strtoul_l(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
517 #ifndef _CRT_SYSTEM_DEFINED
518 #define _CRT_SYSTEM_DEFINED
519   int __cdecl system(const char *_Command);
520 #endif
521   _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
522   int __cdecl wctomb(char *_MbCh,wchar_t _WCh) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
523   _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
524   size_t __cdecl wcstombs(char * __restrict__ _Dest,const wchar_t * __restrict__ _Source,size_t _MaxCount) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
525   _CRTIMP size_t __cdecl _wcstombs_l(char * __restrict__ _Dest,const wchar_t * __restrict__ _Source,size_t _MaxCount,_locale_t _Locale) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
526 
527 #ifndef _CRT_ALLOCATION_DEFINED
528 #define _CRT_ALLOCATION_DEFINED
529   void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements);
530   void __cdecl free(void *_Memory);
531   void *__cdecl malloc(size_t _Size);
532   void *__cdecl realloc(void *_Memory,size_t _NewSize);
533   _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size);
534 /* Make sure that X86intrin.h doesn't produce here collisions.  */
535 #if (!defined (_XMMINTRIN_H_INCLUDED) && !defined (_MM_MALLOC_H_INCLUDED)) || defined(_aligned_malloc)
536 #pragma push_macro("_aligned_free")
537 #pragma push_macro("_aligned_malloc")
538 #undef _aligned_free
539 #undef _aligned_malloc
540   _CRTIMP void __cdecl _aligned_free(void *_Memory);
541   _CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment);
542 #pragma pop_macro("_aligned_free")
543 #pragma pop_macro("_aligned_malloc")
544 #endif
545   _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset);
546   _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment);
547   _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment);
548   _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset);
549   _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset);
550 #endif
551 
552 #ifndef _WSTDLIB_DEFINED
553 #define _WSTDLIB_DEFINED
554 
555   _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
556   _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
557   _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
558 
559   double __cdecl __mingw_wcstod(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr);
560   float __cdecl __mingw_wcstof(const wchar_t * __restrict__ nptr, wchar_t ** __restrict__ endptr);
561   long double __cdecl __mingw_wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__);
562 
563 #if defined(__USE_MINGW_STRTOX)
564   __mingw_ovr
wcstod(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr)565   double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr){
566     return __mingw_wcstod(_Str,_EndPtr);
567   }
568   __mingw_ovr
wcstof(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr)569   float __cdecl wcstof(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr){
570     return __mingw_wcstof(_Str,_EndPtr);
571   }
572   /* wcstold is already a mingw implementation */
573 #else
574   double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr);
575   float __cdecl wcstof(const wchar_t * __restrict__ nptr, wchar_t ** __restrict__ endptr);
576 #endif /* defined(__USE_MINGW_STRTOX) */
577 #if !defined __NO_ISOCEXT /* in libmingwex.a */
578   long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__);
579 #endif /* __NO_ISOCEXT */
580   _CRTIMP double __cdecl _wcstod_l(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr,_locale_t _Locale);
581   long __cdecl wcstol(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr,int _Radix);
582   _CRTIMP long __cdecl _wcstol_l(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
583   unsigned long __cdecl wcstoul(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr,int _Radix);
584   _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t * __restrict__ _Str,wchar_t ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
585   _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
586 #ifndef _CRT_WSYSTEM_DEFINED
587 #define _CRT_WSYSTEM_DEFINED
588   _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
589 #endif
590   _CRTIMP double __cdecl _wtof(const wchar_t *_Str);
591   _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale);
592   _CRTIMP int __cdecl _wtoi(const wchar_t *_Str);
593   _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale);
594   _CRTIMP long __cdecl _wtol(const wchar_t *_Str);
595   _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
596 
597   __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
598   __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
599   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
600   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale);
601   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
602   __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
603   __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
604   __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
605 #endif
606 
607   _CRTIMP int __cdecl _putenv(const char *_EnvString);
608   _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString);
609 
610 #ifndef _POSIX_
611 #define _CVTBUFSIZE (309+40)
612   _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes);
613   _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
614   _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
615   _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
616   _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str);
617   _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str);
618   _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str);
619   _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale);
620   _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale);
621   _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale);
622 
623 #if defined(__INTRIN_H_) || \
624    (defined(_X86INTRIN_H_INCLUDED) && \
625      ((__MINGW_GCC_VERSION >= 40902) || defined(__LP64__) || defined(_X86_)))
626 
627 /* We already have bug-free prototypes and inline definitions for _lrotl
628    and _lrotr from either intrin.h or x86intrin.h. */
629 
630 #else
631 
632 /* Remove buggy x86intrin.h definitions if present (see gcc bug 61662). */
633 #undef _lrotr
634 #undef _lrotl
635 
636 /* These prototypes work for x86, x64 (native Windows), and cyginwin64. */
637 unsigned long __cdecl _lrotl(unsigned long,int);
638 unsigned long __cdecl _lrotr(unsigned long,int);
639 
640 #endif /* defined(__INTRIN_H_) || \
641     (defined(_X86INTRIN_H_INCLUDED) && \
642        ((__MINGW_GCC_VERSION >= 40902) || defined(__LP64__))) */
643 
644   _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext);
645   _onexit_t __cdecl _onexit(_onexit_t _Func);
646 
647 #ifndef _CRT_PERROR_DEFINED
648 #define _CRT_PERROR_DEFINED
649   void __cdecl perror(const char *_ErrMsg);
650 #endif
651 #pragma push_macro ("_rotr64")
652 #pragma push_macro ("_rotl64")
653 #undef _rotl64
654 #undef _rotr64
655   __MINGW_EXTENSION unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift);
656   __MINGW_EXTENSION unsigned __int64 __cdecl _rotr64(unsigned __int64 Value,int Shift);
657 #pragma pop_macro ("_rotl64")
658 #pragma pop_macro ("_rotr64")
659 #pragma push_macro ("_rotr")
660 #pragma push_macro ("_rotl")
661 #undef _rotr
662 #undef _rotl
663   unsigned int __cdecl _rotr(unsigned int _Val,int _Shift);
664   unsigned int __cdecl _rotl(unsigned int _Val,int _Shift);
665 #pragma pop_macro ("_rotl")
666 #pragma pop_macro ("_rotr")
667   __MINGW_EXTENSION unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift);
668   _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
669   _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
670   _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
671 
672 #ifndef _WSTDLIBP_DEFINED
673 #define _WSTDLIBP_DEFINED
674   _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords);
675   _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext);
676 #ifndef _CRT_WPERROR_DEFINED
677 #define _CRT_WPERROR_DEFINED
678   _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
679 #endif
680   _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
681   _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
682 #endif
683 
684   _CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration) __MINGW_ATTRIB_DEPRECATED;
685   /* Not to be confused with  _set_error_mode (int).  */
686   _CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED;
687   _CRTIMP void __cdecl _sleep(unsigned long _Duration) __MINGW_ATTRIB_DEPRECATED;
688 #endif
689 
690 #ifndef	NO_OLDNAMES
691 #ifndef _POSIX_
692 #if 0
693 #ifndef __cplusplus
694 #ifndef NOMINMAX
695 #ifndef max
696 #define max(a,b) (((a) > (b)) ? (a) : (b))
697 #endif
698 #ifndef min
699 #define min(a,b) (((a) < (b)) ? (a) : (b))
700 #endif
701 #endif
702 #endif
703 #endif
704 
705 #define sys_errlist _sys_errlist
706 #define sys_nerr _sys_nerr
707 #define environ _environ
708   char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
709   char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
710   char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
711   char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
712   char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
713   int __cdecl putenv(const char *_EnvString) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
714 
715 #ifndef _CRT_SWAB_DEFINED
716 #define _CRT_SWAB_DEFINED  /* Also in unistd.h */
717   void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
718 #endif
719 
720   char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_MSVC2005;
721   onexit_t __cdecl onexit(onexit_t _Func);
722 #endif
723 #endif
724 
725 #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
726 
727   typedef struct { __MINGW_EXTENSION long long quot, rem; } lldiv_t;
728 
729   __MINGW_EXTENSION lldiv_t __cdecl lldiv(long long, long long);
730 
731   __MINGW_EXTENSION long long __cdecl llabs(long long);
732 #ifndef __CRT__NO_INLINE
llabs(long long _j)733   __MINGW_EXTENSION __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); }
734 #endif
735 
736   __MINGW_EXTENSION long long  __cdecl strtoll(const char * __restrict__, char ** __restrict, int);
737   __MINGW_EXTENSION unsigned long long  __cdecl strtoull(const char * __restrict__, char ** __restrict__, int);
738 
739   /* these are stubs for MS _i64 versions */
740   __MINGW_EXTENSION long long  __cdecl atoll (const char *);
741 
742 #ifndef __STRICT_ANSI__
743   __MINGW_EXTENSION long long  __cdecl wtoll (const wchar_t *);
744   __MINGW_EXTENSION char *__cdecl lltoa (long long, char *, int);
745   __MINGW_EXTENSION char *__cdecl ulltoa (unsigned long long , char *, int);
746   __MINGW_EXTENSION wchar_t *__cdecl lltow (long long, wchar_t *, int);
747   __MINGW_EXTENSION wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int);
748 
749   /* __CRT_INLINE using non-ansi functions */
750 #ifndef __CRT__NO_INLINE
atoll(const char * _c)751   __MINGW_EXTENSION __CRT_INLINE long long  __cdecl atoll (const char * _c) { return _atoi64 (_c); }
lltoa(long long _n,char * _c,int _i)752   __MINGW_EXTENSION __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); }
ulltoa(unsigned long long _n,char * _c,int _i)753   __MINGW_EXTENSION __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); }
wtoll(const wchar_t * _w)754   __MINGW_EXTENSION __CRT_INLINE long long  __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); }
lltow(long long _n,wchar_t * _w,int _i)755   __MINGW_EXTENSION __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); }
ulltow(unsigned long long _n,wchar_t * _w,int _i)756   __MINGW_EXTENSION __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); }
757 #endif /* !__CRT__NO_INLINE */
758 #endif /* (__STRICT_ANSI__)  */
759 
760 #endif /* !__NO_ISOCEXT */
761 
762 #ifdef __cplusplus
763 }
764 #endif
765 
766 #pragma pack(pop)
767 
768 #include <sec_api/stdlib_s.h>
769 #include <malloc.h>
770 
771 #endif
772