OSDN Git Service

Fix MinGW-Bug [2125708].
[pf3gnuchains/pf3gnuchains4x.git] / winsup / mingw / include / stdlib.h
1 /*
2  * stdlib.h
3  * This file has no copyright assigned and is placed in the Public Domain.
4  * This file is a part of the mingw-runtime package.
5  * No warranty is given; refer to the file DISCLAIMER within the package.
6  *
7  * Definitions for common types, variables, and functions.
8  *
9  */
10
11 #ifndef _STDLIB_H_
12 #define _STDLIB_H_
13
14 /* All the headers include this file. */
15 #include <_mingw.h>
16
17 #define __need_size_t
18 #define __need_wchar_t
19 #define __need_NULL
20 #ifndef RC_INVOKED
21 #include <stddef.h>
22 #endif /* RC_INVOKED */
23
24 /*
25  * RAND_MAX is the maximum value that may be returned by rand.
26  * The minimum is zero.
27  */
28 #define RAND_MAX        0x7FFF
29
30 /*
31  * These values may be used as exit status codes.
32  */
33 #define EXIT_SUCCESS    0
34 #define EXIT_FAILURE    1
35
36 /*
37  * Definitions for path name functions.
38  * NOTE: All of these values have simply been chosen to be conservatively high.
39  *       Remember that with long file names we can no longer depend on
40  *       extensions being short.
41  */
42 #ifndef __STRICT_ANSI__
43
44 #ifndef MAX_PATH
45 #define MAX_PATH        (260)
46 #endif
47
48 #define _MAX_PATH       MAX_PATH
49 #define _MAX_DRIVE      (3)
50 #define _MAX_DIR        256
51 #define _MAX_FNAME      256
52 #define _MAX_EXT        256
53
54 #endif  /* Not __STRICT_ANSI__ */
55
56
57 #ifndef RC_INVOKED
58
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62
63 #if !defined (__STRICT_ANSI__)
64
65 /*
66  * This seems like a convenient place to declare these variables, which
67  * give programs using WinMain (or main for that matter) access to main-ish
68  * argc and argv. environ is a pointer to a table of environment variables.
69  * NOTE: Strings in _argv and environ are ANSI strings.
70  */
71 extern int      _argc;
72 extern char**   _argv;
73
74 /* imports from runtime dll of the above variables */
75 #ifdef __MSVCRT__
76
77 extern int*  __cdecl __MINGW_NOTHROW   __p___argc(void);
78 extern char*** __cdecl __MINGW_NOTHROW  __p___argv(void);
79 extern wchar_t***  __cdecl __MINGW_NOTHROW __p___wargv(void);
80
81 #define __argc (*__p___argc())
82 #define __argv (*__p___argv())
83 #define __wargv (*__p___wargv())
84
85 #else /* !MSVCRT */
86
87 #ifndef __DECLSPEC_SUPPORTED
88
89 extern int*    _imp____argc_dll;
90 extern char***  _imp____argv_dll;
91 #define __argc (*_imp____argc_dll)
92 #define __argv (*_imp____argv_dll)
93
94 #else /* __DECLSPEC_SUPPORTED */
95
96 __MINGW_IMPORT int    __argc_dll;
97 __MINGW_IMPORT char**  __argv_dll;
98 #define __argc __argc_dll
99 #define __argv __argv_dll
100
101 #endif /* __DECLSPEC_SUPPORTED */
102
103 #endif /* __MSVCRT */
104 #endif /* __STRICT_ANSI__ */
105 /*
106  * Also defined in ctype.h.
107  */
108 #ifndef MB_CUR_MAX
109 #ifdef __DECLSPEC_SUPPORTED
110 # ifdef __MSVCRT__
111 #  define MB_CUR_MAX __mb_cur_max
112    __MINGW_IMPORT int __mb_cur_max;
113 # else          /* not __MSVCRT */
114 #  define MB_CUR_MAX __mb_cur_max_dll
115    __MINGW_IMPORT int __mb_cur_max_dll;
116 # endif         /* not __MSVCRT */
117
118 #else           /* ! __DECLSPEC_SUPPORTED */
119 # ifdef __MSVCRT__
120    extern int* _imp____mbcur_max;
121 #  define MB_CUR_MAX (*_imp____mb_cur_max)
122 # else          /* not __MSVCRT */
123    extern int*  _imp____mbcur_max_dll;
124 #  define MB_CUR_MAX (*_imp____mb_cur_max_dll)
125 # endif         /* not __MSVCRT */
126 #endif          /*  __DECLSPEC_SUPPORTED */
127 #endif  /* MB_CUR_MAX */
128
129 /* 
130  * MS likes to declare errno in stdlib.h as well. 
131  */
132
133 #ifdef _UWIN
134 #undef errno
135 extern int errno;
136 #else
137  _CRTIMP int* __cdecl __MINGW_NOTHROW   _errno(void);
138 #define errno           (*_errno())
139 #endif
140  _CRTIMP int* __cdecl __MINGW_NOTHROW   __doserrno(void);
141 #define _doserrno       (*__doserrno())
142
143 #if !defined (__STRICT_ANSI__)
144 /*
145  * Use environ from the DLL, not as a global. 
146  */
147
148 #ifdef __MSVCRT__
149   extern _CRTIMP char *** __cdecl __MINGW_NOTHROW __p__environ(void);
150   extern _CRTIMP wchar_t *** __cdecl __MINGW_NOTHROW  __p__wenviron(void);
151 # define _environ (*__p__environ())
152 # define _wenviron (*__p__wenviron())
153 #else /* ! __MSVCRT__ */
154 # ifndef __DECLSPEC_SUPPORTED
155     extern char *** _imp___environ_dll;
156 #   define _environ (*_imp___environ_dll)
157 # else /* __DECLSPEC_SUPPORTED */
158     __MINGW_IMPORT char ** _environ_dll;
159 #   define _environ _environ_dll
160 # endif /* __DECLSPEC_SUPPORTED */
161 #endif /* ! __MSVCRT__ */
162
163 #define environ _environ
164
165 #ifdef  __MSVCRT__
166 /* One of the MSVCRTxx libraries */
167
168 #ifndef __DECLSPEC_SUPPORTED
169   extern int*   _imp___sys_nerr;
170 # define        sys_nerr        (*_imp___sys_nerr)
171 #else /* __DECLSPEC_SUPPORTED */
172   __MINGW_IMPORT int    _sys_nerr;
173 # ifndef _UWIN
174 #   define      sys_nerr        _sys_nerr
175 # endif /* _UWIN */
176 #endif /* __DECLSPEC_SUPPORTED */
177
178 #else /* ! __MSVCRT__ */
179
180 /* CRTDLL run time library */
181
182 #ifndef __DECLSPEC_SUPPORTED
183   extern int*   _imp___sys_nerr_dll;
184 # define sys_nerr       (*_imp___sys_nerr_dll)
185 #else /* __DECLSPEC_SUPPORTED */
186   __MINGW_IMPORT int    _sys_nerr_dll;
187 # define sys_nerr       _sys_nerr_dll
188 #endif /* __DECLSPEC_SUPPORTED */
189
190 #endif /* ! __MSVCRT__ */
191
192 #ifndef __DECLSPEC_SUPPORTED
193 extern char***  _imp__sys_errlist;
194 #define sys_errlist     (*_imp___sys_errlist)
195 #else /* __DECLSPEC_SUPPORTED */
196 __MINGW_IMPORT char*    _sys_errlist[];
197 #ifndef _UWIN
198 #define sys_errlist     _sys_errlist
199 #endif /* _UWIN */
200 #endif /* __DECLSPEC_SUPPORTED */
201
202 /*
203  * OS version and such constants.
204  */
205
206 #ifdef  __MSVCRT__
207 /* msvcrtxx.dll */
208
209 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__osver(void);
210 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__winver(void);
211 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__winmajor(void);
212 extern _CRTIMP unsigned __cdecl __MINGW_NOTHROW int*    __p__winminor(void);
213
214 #ifndef __DECLSPEC_SUPPORTED
215 # define _osver         (*__p__osver())
216 # define _winver        (*__p__winver())
217 # define _winmajor      (*__p__winmajor())
218 # define _winminor      (*__p__winminor())
219 #else
220 __MINGW_IMPORT unsigned int _osver;
221 __MINGW_IMPORT unsigned int _winver;
222 __MINGW_IMPORT unsigned int _winmajor;
223 __MINGW_IMPORT unsigned int _winminor;
224 #endif /* __DECLSPEC_SUPPORTED */
225
226 #else
227 /* Not msvcrtxx.dll, thus crtdll.dll */
228
229 #ifndef __DECLSPEC_SUPPORTED
230
231 extern unsigned int*    _imp___osver_dll;
232 extern unsigned int*    _imp___winver_dll;
233 extern unsigned int*    _imp___winmajor_dll;
234 extern unsigned int*    _imp___winminor_dll;
235
236 #define _osver          (*_imp___osver_dll)
237 #define _winver         (*_imp___winver_dll)
238 #define _winmajor       (*_imp___winmajor_dll)
239 #define _winminor       (*_imp___winminor_dll)
240
241 #else /* __DECLSPEC_SUPPORTED */
242
243 __MINGW_IMPORT unsigned int     _osver_dll;
244 __MINGW_IMPORT unsigned int     _winver_dll;
245 __MINGW_IMPORT unsigned int     _winmajor_dll;
246 __MINGW_IMPORT unsigned int     _winminor_dll;
247
248 #define _osver          _osver_dll
249 #define _winver         _winver_dll
250 #define _winmajor       _winmajor_dll
251 #define _winminor       _winminor_dll
252
253 #endif /* __DECLSPEC_SUPPORTED */
254
255 #endif
256
257 #if defined  __MSVCRT__
258 /* although the _pgmptr is exported as DATA,
259  * be safe and use the access function __p__pgmptr() to get it. */
260 _CRTIMP char** __cdecl __MINGW_NOTHROW __p__pgmptr(void);
261 #define _pgmptr     (*__p__pgmptr())
262 _CRTIMP wchar_t** __cdecl __MINGW_NOTHROW __p__wpgmptr(void);
263 #define _wpgmptr    (*__p__wpgmptr())
264 #else /* ! __MSVCRT__ */
265 # ifndef __DECLSPEC_SUPPORTED
266   extern char** __imp__pgmptr_dll;
267 # define _pgmptr (*_imp___pgmptr_dll)
268 # else /* __DECLSPEC_SUPPORTED */
269  __MINGW_IMPORT char* _pgmptr_dll;
270 # define _pgmptr _pgmptr_dll
271 # endif /* __DECLSPEC_SUPPORTED */
272 /* no wide version in CRTDLL */
273 #endif /* __MSVCRT__ */
274
275 /*
276  * This variable determines the default file mode.
277  * TODO: Which flags work?
278  */
279 #if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME)
280
281 #ifdef __MSVCRT__
282 extern int* _imp___fmode;
283 #define _fmode  (*_imp___fmode)
284 #else
285 /* CRTDLL */
286 extern int* _imp___fmode_dll;
287 #define _fmode  (*_imp___fmode_dll)
288 #endif
289
290 #else /* __DECLSPEC_SUPPORTED */
291
292 #ifdef __MSVCRT__
293 __MINGW_IMPORT  int _fmode;
294 #else /* ! __MSVCRT__ */
295 __MINGW_IMPORT  int _fmode_dll;
296 #define _fmode  _fmode_dll
297 #endif /* ! __MSVCRT__ */
298
299 #endif /* __DECLSPEC_SUPPORTED */
300
301 #endif /* Not __STRICT_ANSI__ */
302
303 _CRTIMP double __cdecl __MINGW_NOTHROW  atof    (const char*);
304 _CRTIMP int __cdecl __MINGW_NOTHROW     atoi    (const char*);
305 _CRTIMP long __cdecl __MINGW_NOTHROW    atol    (const char*);
306 #if !defined (__STRICT_ANSI__)
307 _CRTIMP int __cdecl __MINGW_NOTHROW     _wtoi (const wchar_t *);
308 _CRTIMP long __cdecl __MINGW_NOTHROW _wtol (const wchar_t *);
309 #endif
310 #if !defined __NO_ISOCEXT  /*  in libmingwex.a */
311 double __cdecl __MINGW_NOTHROW __strtod (const char*, char**);
312 #ifdef __cplusplus
313 /* We require a function with external linkage. */
314 #else
315 static
316 #endif /* Not __cplusplus */
317 inline double __cdecl __MINGW_NOTHROW strtod (const char* __restrict__ __nptr, char** __restrict__ __endptr)
318 { return __strtod(__nptr, __endptr); }
319 float __cdecl __MINGW_NOTHROW strtof (const char * __restrict__, char ** __restrict__);
320 long double __cdecl __MINGW_NOTHROW strtold (const char * __restrict__, char ** __restrict__);
321 #else
322 _CRTIMP double __cdecl __MINGW_NOTHROW  strtod  (const char*, char**);
323 #endif /* __NO_ISOCEXT */
324
325 _CRTIMP long __cdecl __MINGW_NOTHROW    strtol  (const char*, char**, int);
326 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW   strtoul (const char*, char**, int);
327
328 #ifndef _WSTDLIB_DEFINED
329 /*  also declared in wchar.h */
330 _CRTIMP long __cdecl __MINGW_NOTHROW    wcstol  (const wchar_t*, wchar_t**, int);
331 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW   wcstoul (const wchar_t*, wchar_t**, int);
332 _CRTIMP double __cdecl __MINGW_NOTHROW  wcstod  (const wchar_t*, wchar_t**);
333 #if !defined __NO_ISOCEXT /*  in libmingwex.a */
334 float __cdecl __MINGW_NOTHROW wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__);
335 long double __cdecl __MINGW_NOTHROW wcstold (const wchar_t * __restrict__, wchar_t ** __restrict__);
336 #endif /* __NO_ISOCEXT */
337 #ifdef __MSVCRT__ 
338 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wgetenv(const wchar_t*);
339 _CRTIMP int __cdecl __MINGW_NOTHROW     _wputenv(const wchar_t*);
340 _CRTIMP void __cdecl __MINGW_NOTHROW    _wsearchenv(const wchar_t*, const wchar_t*, wchar_t*);
341 _CRTIMP int __cdecl __MINGW_NOTHROW     _wsystem(const wchar_t*);
342 _CRTIMP void __cdecl __MINGW_NOTHROW    _wmakepath(wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*, const wchar_t*);
343 _CRTIMP void __cdecl __MINGW_NOTHROW    _wsplitpath (const wchar_t*, wchar_t*, wchar_t*, wchar_t*, wchar_t*);
344 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW   _wfullpath (wchar_t*, const wchar_t*, size_t);
345 #endif
346 #define _WSTDLIB_DEFINED
347 #endif
348
349 _CRTIMP size_t __cdecl __MINGW_NOTHROW  wcstombs        (char*, const wchar_t*, size_t);
350 _CRTIMP int __cdecl __MINGW_NOTHROW     wctomb          (char*, wchar_t);
351
352 _CRTIMP int __cdecl __MINGW_NOTHROW     mblen           (const char*, size_t);
353 _CRTIMP size_t __cdecl __MINGW_NOTHROW  mbstowcs        (wchar_t*, const char*, size_t);
354 _CRTIMP int __cdecl __MINGW_NOTHROW     mbtowc          (wchar_t*, const char*, size_t);
355
356 _CRTIMP int __cdecl __MINGW_NOTHROW     rand    (void);
357 _CRTIMP void __cdecl __MINGW_NOTHROW    srand   (unsigned int);
358
359 _CRTIMP void* __cdecl __MINGW_NOTHROW   calloc  (size_t, size_t) __MINGW_ATTRIB_MALLOC;
360 _CRTIMP void* __cdecl __MINGW_NOTHROW   malloc  (size_t) __MINGW_ATTRIB_MALLOC;
361 _CRTIMP void* __cdecl __MINGW_NOTHROW   realloc (void*, size_t);
362 _CRTIMP void __cdecl __MINGW_NOTHROW    free    (void*);
363 _CRTIMP void __cdecl __MINGW_NOTHROW    abort   (void) __MINGW_ATTRIB_NORETURN;
364 _CRTIMP void __cdecl __MINGW_NOTHROW    exit    (int) __MINGW_ATTRIB_NORETURN;
365
366 /* Note: This is in startup code, not imported directly from dll */
367 int __cdecl __MINGW_NOTHROW     atexit  (void (*)(void));
368
369 _CRTIMP int __cdecl __MINGW_NOTHROW     system  (const char*);
370 _CRTIMP char* __cdecl __MINGW_NOTHROW   getenv  (const char*);
371
372 /* bsearch and qsort are also in non-ANSI header search.h  */
373 _CRTIMP void* __cdecl bsearch (const void*, const void*, size_t, size_t, 
374                                int (*)(const void*, const void*));
375 _CRTIMP void __cdecl qsort(void*, size_t, size_t,
376                            int (*)(const void*, const void*));
377
378 _CRTIMP int __cdecl __MINGW_NOTHROW     abs     (int) __MINGW_ATTRIB_CONST;
379 _CRTIMP long __cdecl __MINGW_NOTHROW    labs    (long) __MINGW_ATTRIB_CONST;
380
381 /*
382  * div_t and ldiv_t are structures used to return the results of div and
383  * ldiv.
384  *
385  * NOTE: div and ldiv appear not to work correctly unless
386  *       -fno-pcc-struct-return is specified. This is included in the
387  *       mingw32 specs file.
388  */
389 typedef struct { int quot, rem; } div_t;
390 typedef struct { long quot, rem; } ldiv_t;
391
392 _CRTIMP div_t __cdecl __MINGW_NOTHROW   div     (int, int) __MINGW_ATTRIB_CONST;
393 _CRTIMP ldiv_t __cdecl __MINGW_NOTHROW  ldiv    (long, long) __MINGW_ATTRIB_CONST;
394
395 #if !defined (__STRICT_ANSI__)
396
397 /*
398  * NOTE: Officially the three following functions are obsolete. The Win32 API
399  *       functions SetErrorMode, Beep and Sleep are their replacements.
400  */
401 _CRTIMP void __cdecl __MINGW_NOTHROW    _beep (unsigned int, unsigned int) __MINGW_ATTRIB_DEPRECATED;
402 /* Not to be confused with  _set_error_mode (int).  */
403 _CRTIMP void __cdecl __MINGW_NOTHROW    _seterrormode (int) __MINGW_ATTRIB_DEPRECATED;
404 _CRTIMP void __cdecl __MINGW_NOTHROW    _sleep (unsigned long) __MINGW_ATTRIB_DEPRECATED;
405
406 _CRTIMP void __cdecl __MINGW_NOTHROW    _exit   (int) __MINGW_ATTRIB_NORETURN;
407
408 /* _onexit is MS extension. Use atexit for portability.  */
409 /* Note: This is in startup code, not imported directly from dll */
410 typedef  int (* _onexit_t)(void);
411 _onexit_t __cdecl __MINGW_NOTHROW _onexit( _onexit_t );
412
413 _CRTIMP int __cdecl __MINGW_NOTHROW     _putenv (const char*);
414 _CRTIMP void __cdecl __MINGW_NOTHROW    _searchenv (const char*, const char*, char*);
415
416 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ecvt (double, int, int*, int*);
417 _CRTIMP char* __cdecl __MINGW_NOTHROW   _fcvt (double, int, int*, int*);
418 _CRTIMP char* __cdecl __MINGW_NOTHROW   _gcvt (double, int, char*);
419
420 _CRTIMP void __cdecl __MINGW_NOTHROW    _makepath (char*, const char*, const char*, const char*, const char*);
421 _CRTIMP void __cdecl __MINGW_NOTHROW    _splitpath (const char*, char*, char*, char*, char*);
422 _CRTIMP char* __cdecl __MINGW_NOTHROW   _fullpath (char*, const char*, size_t);
423
424 _CRTIMP char* __cdecl __MINGW_NOTHROW   _itoa (int, char*, int);
425 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ltoa (long, char*, int);
426 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ultoa(unsigned long, char*, int);
427 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _itow (int, wchar_t*, int);
428 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _ltow (long, wchar_t*, int);
429 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW  _ultow (unsigned long, wchar_t*, int);
430
431 #ifdef __MSVCRT__
432 _CRTIMP __int64 __cdecl __MINGW_NOTHROW _atoi64(const char *);
433 _CRTIMP char* __cdecl __MINGW_NOTHROW   _i64toa(__int64, char *, int);
434 _CRTIMP char* __cdecl __MINGW_NOTHROW   _ui64toa(unsigned __int64, char *, int);
435 _CRTIMP __int64 __cdecl __MINGW_NOTHROW _wtoi64(const wchar_t *);
436 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _i64tow(__int64, wchar_t *, int);
437 _CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _ui64tow(unsigned __int64, wchar_t *, int);
438
439 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _rotl(unsigned int, int) __MINGW_ATTRIB_CONST;
440 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _rotr(unsigned int, int) __MINGW_ATTRIB_CONST;
441 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotl(unsigned long, int) __MINGW_ATTRIB_CONST;
442 _CRTIMP unsigned long __cdecl __MINGW_NOTHROW _lrotr(unsigned long, int) __MINGW_ATTRIB_CONST;
443
444 _CRTIMP int __cdecl __MINGW_NOTHROW _set_error_mode (int);
445
446 # define _OUT_TO_DEFAULT        0
447 # define _OUT_TO_STDERR         1
448 # define _OUT_TO_MSGBOX         2
449 # define _REPORT_ERRMODE        3
450
451 # if __MSVCRT_VERSION__ >= 0x800
452 #  ifndef _UINTPTR_T_DEFINED
453 #   define _UINTPTR_T_DEFINED
454 #   ifdef _WIN64
455       typedef unsigned __int64 uintptr_t;
456 #   else
457       typedef unsigned int uintptr_t;
458 #   endif
459 #  endif
460
461 _CRTIMP unsigned int __cdecl __MINGW_NOTHROW _set_abort_behavior (unsigned int, unsigned int);
462
463 /* These masks work with msvcr80.dll version 8.0.50215.44 (a beta release).  */
464 #  define _WRITE_ABORT_MSG      1
465 #  define _CALL_REPORTFAULT     2
466
467 typedef void
468 (* _invalid_parameter_handler) (
469     const wchar_t *,
470     const wchar_t *,
471     const wchar_t *,
472     unsigned int,
473     uintptr_t);
474 _invalid_parameter_handler _set_invalid_parameter_handler (_invalid_parameter_handler);
475
476 # endif /* __MSVCRT_VERSION__ >= 0x800 */
477 #endif /* __MSVCRT__ */
478
479 #ifndef _NO_OLDNAMES
480
481 _CRTIMP int __cdecl __MINGW_NOTHROW     putenv (const char*);
482 _CRTIMP void __cdecl __MINGW_NOTHROW    searchenv (const char*, const char*, char*);
483
484 _CRTIMP char* __cdecl __MINGW_NOTHROW   itoa (int, char*, int);
485 _CRTIMP char* __cdecl __MINGW_NOTHROW   ltoa (long, char*, int);
486
487 #ifndef _UWIN
488 _CRTIMP char* __cdecl __MINGW_NOTHROW   ecvt (double, int, int*, int*);
489 _CRTIMP char* __cdecl __MINGW_NOTHROW   fcvt (double, int, int*, int*);
490 _CRTIMP char* __cdecl __MINGW_NOTHROW   gcvt (double, int, char*);
491 #endif /* _UWIN */
492 #endif  /* Not _NO_OLDNAMES */
493
494 #endif  /* Not __STRICT_ANSI__ */
495
496 /* C99 names */
497
498 #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
499
500 /* C99 name for _exit */
501 void __cdecl __MINGW_NOTHROW _Exit(int) __MINGW_ATTRIB_NORETURN;
502 #ifndef __STRICT_ANSI__   /* inline using non-ansi functions */
503 __CRT_INLINE void __cdecl __MINGW_NOTHROW _Exit(int __status)
504         {  _exit (__status); }
505 #endif 
506
507 typedef struct { long long quot, rem; } lldiv_t;
508
509 lldiv_t __cdecl __MINGW_NOTHROW lldiv (long long, long long) __MINGW_ATTRIB_CONST;
510
511 long long __cdecl __MINGW_NOTHROW llabs(long long);
512 __CRT_INLINE long long __cdecl __MINGW_NOTHROW llabs(long long _j)
513   {return (_j >= 0 ? _j : -_j);}
514
515 long long  __cdecl __MINGW_NOTHROW strtoll (const char* __restrict__, char** __restrict, int);
516 unsigned long long  __cdecl __MINGW_NOTHROW strtoull (const char* __restrict__, char** __restrict__, int);
517
518 #if defined (__MSVCRT__) /* these are stubs for MS _i64 versions */ 
519 long long  __cdecl __MINGW_NOTHROW atoll (const char *);
520
521 #if !defined (__STRICT_ANSI__)
522 long long  __cdecl __MINGW_NOTHROW wtoll (const wchar_t *);
523 char* __cdecl __MINGW_NOTHROW lltoa (long long, char *, int);
524 char* __cdecl __MINGW_NOTHROW ulltoa (unsigned long long , char *, int);
525 wchar_t* __cdecl __MINGW_NOTHROW lltow (long long, wchar_t *, int);
526 wchar_t* __cdecl __MINGW_NOTHROW ulltow (unsigned long long, wchar_t *, int);
527
528   /* inline using non-ansi functions */
529 __CRT_INLINE long long  __cdecl __MINGW_NOTHROW atoll (const char * _c)
530         { return _atoi64 (_c); }
531 __CRT_INLINE char*  __cdecl __MINGW_NOTHROW lltoa (long long _n, char * _c, int _i)
532         { return _i64toa (_n, _c, _i); }
533 __CRT_INLINE char*  __cdecl __MINGW_NOTHROW ulltoa (unsigned long long _n, char * _c, int _i)
534         { return _ui64toa (_n, _c, _i); }
535 __CRT_INLINE long long  __cdecl __MINGW_NOTHROW wtoll (const wchar_t * _w)
536         { return _wtoi64 (_w); }
537 __CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW lltow (long long _n, wchar_t * _w, int _i)
538         { return _i64tow (_n, _w, _i); } 
539 __CRT_INLINE wchar_t*  __cdecl __MINGW_NOTHROW ulltow (unsigned long long _n, wchar_t * _w, int _i)
540         { return _ui64tow (_n, _w, _i); } 
541 #endif /* (__STRICT_ANSI__)  */
542
543 #endif /* __MSVCRT__ */
544
545 #endif /* !__NO_ISOCEXT */
546
547
548 #ifdef __cplusplus
549 }
550 #endif
551
552 #endif  /* Not RC_INVOKED */
553
554 #endif  /* Not _STDLIB_H_ */
555