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