OSDN Git Service

d9dac5d5881073073f3ffb4e77d99138545ad4ee
[mingw/mingw-org-wsl.git] / mingwrt / include / stdlib.h
1 /*
2  * stdlib.h
3  *
4  * ANSI/POSIX + Microsoft compatible standard library function prototypes,
5  * associated macros, and manifest constant definitions.
6  *
7  * $Id$
8  *
9  * Written by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
10  * Copyright (C) 1997-2009, 2011, 2014-2016, 2018, 2020, MinGW.org Project.
11  *
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a
14  * copy of this software and associated documentation files (the "Software"),
15  * to deal in the Software without restriction, including without limitation
16  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
17  * and/or sell copies of the Software, and to permit persons to whom the
18  * Software is furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice, this permission notice, and the following
21  * disclaimer shall be included in all copies or substantial portions of
22  * the Software.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
27  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF OR OTHER
30  * DEALINGS IN THE SOFTWARE.
31  *
32  */
33 #ifndef _STDLIB_H
34 #pragma GCC system_header
35
36 /* Some of the content of this header is made selectively accessible,
37  * when indirectly included via <wchar.h>; only when we have established
38  * that this inclusion is NOT via this selective method...
39  */
40 #ifndef __WCHAR_H_SOURCED__
41  /* ...do we define the repeat inclusion guard for <stdlib.h> itself.
42   */
43 #define _STDLIB_H
44
45 /* All MinGW headers must include <_mingw.h>; if included via <wchar.h>,
46  * we assume that this has been done already, otherwise we must attend to
47  * it for <stdlib.h>.
48  */
49 #include <_mingw.h>
50
51 #ifndef RC_INVOKED
52 #define __need_size_t
53 #define __need_wchar_t
54 #define __need_NULL
55 #include <stddef.h>
56 #endif /* RC_INVOKED */
57
58 /* RAND_MAX is the maximum value that may be returned by rand.
59  * The minimum is zero.
60  */
61 #define RAND_MAX        0x7FFF
62
63 /* These values may be used as exit status codes.
64  */
65 #define EXIT_SUCCESS    0
66 #define EXIT_FAILURE    1
67
68 /* Definitions for path name functions.
69  * NOTE: All of these values have simply been chosen to be conservatively
70  * high.  Remember that with long file names we can no longer depend on
71  * extensions being short.
72  */
73 #ifndef __STRICT_ANSI__
74
75 #ifndef MAX_PATH
76 #define MAX_PATH        (260)
77 #endif
78
79 #define _MAX_PATH       MAX_PATH
80 #define _MAX_DRIVE      (3)
81 #define _MAX_DIR        256
82 #define _MAX_FNAME      256
83 #define _MAX_EXT        256
84
85 #endif  /* !__STRICT_ANSI__ */
86 #endif  /* !__WCHAR_H_SOURCED__ */
87
88 #ifndef RC_INVOKED
89
90 _BEGIN_C_DECLS
91
92 #ifdef _STDLIB_H
93 #if ! defined __STRICT_ANSI__
94 /* This seems like a convenient place to declare these variables, which
95  * give programs using WinMain (or main for that matter) access to main-ish
96  * argc and argv. environ is a pointer to a table of environment variables.
97  * NOTE: Strings in _argv and environ are ANSI strings.
98  */
99 extern int     _argc;
100 extern char  **_argv;
101
102 #ifdef __MSVCRT__
103 /* Imports from the runtime DLL, for the above variables.
104  */
105 extern __cdecl __MINGW_NOTHROW  int       *__p___argc(void);
106 extern __cdecl __MINGW_NOTHROW  char    ***__p___argv(void);
107 extern __cdecl __MINGW_NOTHROW  wchar_t ***__p___wargv(void);
108
109 #define __argc (*__p___argc())
110 #define __argv (*__p___argv())
111 #define __wargv (*__p___wargv())
112
113 #else  /* ! __MSVCRT__ */
114
115 #ifndef __DECLSPEC_SUPPORTED
116
117 extern int    *_imp____argc_dll;
118 extern char ***_imp____argv_dll;
119
120 #define __argc (*_imp____argc_dll)
121 #define __argv (*_imp____argv_dll)
122
123 #else  /* __DECLSPEC_SUPPORTED */
124
125 __MINGW_IMPORT int    __argc_dll;
126 __MINGW_IMPORT char **__argv_dll;
127
128 #define __argc __argc_dll
129 #define __argv __argv_dll
130
131 #endif  /* __DECLSPEC_SUPPORTED */
132
133 #endif  /* __MSVCRT__ */
134 #endif  /* __STRICT_ANSI__ */
135
136 #ifndef MB_CUR_MAX
137 /* FIXME: also defined in <ctype.h>; should be factored out.
138  */
139 #ifdef __DECLSPEC_SUPPORTED
140 # ifdef __MSVCRT__
141 #  define MB_CUR_MAX __mb_cur_max
142    __MINGW_IMPORT int __mb_cur_max;
143 # else  /* ! __MSVCRT__ */
144 #  define MB_CUR_MAX __mb_cur_max_dll
145    __MINGW_IMPORT int __mb_cur_max_dll;
146 # endif  /* ! __MSVCRT__ */
147
148 #else  /* ! __DECLSPEC_SUPPORTED */
149 # ifdef __MSVCRT__
150    extern int* _imp____mb_cur_max;
151 #  define MB_CUR_MAX (*_imp____mb_cur_max)
152 # else  /* ! __MSVCRT__ */
153    extern int*  _imp____mb_cur_max_dll;
154 #  define MB_CUR_MAX (*_imp____mb_cur_max_dll)
155 # endif  /* ! __MSVCRT__ */
156 #endif  /*  __DECLSPEC_SUPPORTED */
157 #endif  /* MB_CUR_MAX */
158
159 /* In MSVCR80.DLL, Microsoft introduced the following pair of errno
160  * accessor functions; they subsequently became available in MSVCRT.DLL
161  * from Vista onward.  Although they are not required by ISO-C, and they
162  * are more cumbersome to use, than referring to errno directly, the GCC
163  * developers have gratuitously chosen to assume, in GCC-9.x, that they
164  * are always supported on MS-Windows, regardless of Windows version.
165  * Logically, we might expect these to be declared in <errno.h>, but
166  * Microsoft's documentation insists that they are actually declared
167  * here; thus, to satisfy the GCC-9.x requirement, we will declare
168  * them unconditionally here ...
169  */
170 __cdecl __MINGW_NOTHROW  int _get_errno(int *);
171 __cdecl __MINGW_NOTHROW  int _set_errno(int);
172
173 /* ... then provide in-line implementations, (depending on gratuitous
174  * exposure of EINVAL, which strictly belongs in <errno.h> only, while
175  * also requiring declaring the ISO-C errno feature, which Microsoft
176  * documentation calls for both here, and in <errno.h>; we satisfy
177  * both of these requirements by selective <errno.h> inclusion).
178  */
179 #define __STDLIB_H_SOURCED__ 1
180 #include "errno.h"
181
182 #if __MSVCRT_VERSION__ < __MSVCR80_DLL && _WIN32_WINNT < _WIN32_WINNT_VISTA
183 /* These in-line implementations will support universal use of this API,
184  * even on legacy Windows versions pre-dating Vista, without requiring use
185  * of non-free MSVCRT80.DLL or later.
186  */
187 __CRT_ALIAS __cdecl __MINGW_NOTHROW  int _get_errno( int *__val )
188 { return (__val == NULL) ? (errno = EINVAL) : 0 & (*__val = errno); }
189
190 __CRT_ALIAS __cdecl __MINGW_NOTHROW  int _set_errno( int __val )
191 { errno = __val; return 0; }
192
193 #endif
194 #undef __STDLIB_H_SOURCED__
195
196 _CRTIMP __cdecl __MINGW_NOTHROW  int *__doserrno(void);
197 #define _doserrno  (*__doserrno())
198
199 #if !defined (__STRICT_ANSI__)
200 /* Use environ from the DLL, not as a global.
201  */
202 #ifdef __MSVCRT__
203 # define _environ  (*__p__environ())
204 extern _CRTIMP __cdecl __MINGW_NOTHROW  char ***__p__environ(void);
205 # define _wenviron  (*__p__wenviron())
206 extern _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t ***__p__wenviron(void);
207
208 #else  /* ! __MSVCRT__ */
209 # ifndef __DECLSPEC_SUPPORTED
210 # define _environ (*_imp___environ_dll)
211 extern char ***_imp___environ_dll;
212
213 # else  /* __DECLSPEC_SUPPORTED */
214 # define _environ  _environ_dll
215 __MINGW_IMPORT char ** _environ_dll;
216 # endif  /* __DECLSPEC_SUPPORTED */
217 #endif  /* ! __MSVCRT__ */
218
219 #define environ _environ
220
221 #ifdef  __MSVCRT__
222 /* One of the MSVCRTxx libraries */
223
224 #ifndef __DECLSPEC_SUPPORTED
225 # define sys_nerr  (*_imp___sys_nerr)
226 extern int *_imp___sys_nerr;
227
228 #else /* __DECLSPEC_SUPPORTED */
229 __MINGW_IMPORT int _sys_nerr;
230
231 # ifndef _UWIN
232 # define sys_nerr  _sys_nerr
233 # endif  /* _UWIN */
234 #endif  /* __DECLSPEC_SUPPORTED */
235
236 #else  /* ! __MSVCRT__ */
237 /* CRTDLL run time library */
238
239 #ifndef __DECLSPEC_SUPPORTED
240   extern int*   _imp___sys_nerr_dll;
241 # define sys_nerr       (*_imp___sys_nerr_dll)
242 #else  /* __DECLSPEC_SUPPORTED */
243   __MINGW_IMPORT int    _sys_nerr_dll;
244 # define sys_nerr       _sys_nerr_dll
245 #endif  /* __DECLSPEC_SUPPORTED */
246
247 #endif  /* ! __MSVCRT__ */
248
249 #ifndef __DECLSPEC_SUPPORTED
250 #define sys_errlist  (*_imp___sys_errlist)
251 extern char ***_imp__sys_errlist;
252
253 #else  /* __DECLSPEC_SUPPORTED */
254 __MINGW_IMPORT char *_sys_errlist[];
255
256 #ifndef _UWIN
257 #define sys_errlist  _sys_errlist
258 #endif  /* _UWIN */
259 #endif  /* __DECLSPEC_SUPPORTED */
260
261 /* OS version and such constants.
262  */
263 #ifdef  __MSVCRT__ /* MSVCRT.DLL and MSVCRxx.DLL variants */
264
265 extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__osver(void);
266 extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__winver(void);
267 extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__winmajor(void);
268 extern _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int *__p__winminor(void);
269
270 #ifndef __DECLSPEC_SUPPORTED
271 # define _osver     (*__p__osver())
272 # define _winver    (*__p__winver())
273 # define _winmajor  (*__p__winmajor())
274 # define _winminor  (*__p__winminor())
275
276 #else /* __DECLSPEC_SUPPORTED */
277 __MINGW_IMPORT  unsigned int _osver;
278 __MINGW_IMPORT  unsigned int _winver;
279 __MINGW_IMPORT  unsigned int _winmajor;
280 __MINGW_IMPORT  unsigned int _winminor;
281 #endif  /* __DECLSPEC_SUPPORTED */
282
283 #else  /* ! __MSVCRT__; thus CRTDLL */
284 #ifndef __DECLSPEC_SUPPORTED
285
286 #define _osver      (*_imp___osver_dll)
287 #define _winver    (*_imp___winver_dll)
288 #define _winmajor  (*_imp___winmajor_dll)
289 #define _winminor  (*_imp___winminor_dll)
290
291 extern unsigned int *_imp___osver_dll;
292 extern unsigned int *_imp___winver_dll;
293 extern unsigned int *_imp___winmajor_dll;
294 extern unsigned int *_imp___winminor_dll;
295
296 #else  /* __DECLSPEC_SUPPORTED */
297
298 #define _osver      _osver_dll
299 #define _winver    _winver_dll
300 #define _winmajor  _winmajor_dll
301 #define _winminor  _winminor_dll
302
303 __MINGW_IMPORT unsigned int _osver_dll;
304 __MINGW_IMPORT unsigned int _winver_dll;
305 __MINGW_IMPORT unsigned int _winmajor_dll;
306 __MINGW_IMPORT unsigned int _winminor_dll;
307
308 #endif  /* __DECLSPEC_SUPPORTED */
309 #endif  /* CRTDLL */
310
311 #if defined  __MSVCRT__
312 /* Although _pgmptr is exported as DATA, be safe and use the access
313  * function __p__pgmptr() to get it.
314  */
315 #define _pgmptr  (*__p__pgmptr())
316 _CRTIMP __cdecl __MINGW_NOTHROW  char **__p__pgmptr(void);
317
318 #define _wpgmptr  (*__p__wpgmptr())
319 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t **__p__wpgmptr(void);
320
321 #else  /* ! __MSVCRT__; thus CRTDLL */
322
323 # ifndef __DECLSPEC_SUPPORTED
324 # define _pgmptr  (*_imp___pgmptr_dll)
325 extern char **__imp__pgmptr_dll;
326
327 # else  /* __DECLSPEC_SUPPORTED */
328
329 # define _pgmptr _pgmptr_dll
330 __MINGW_IMPORT  char *_pgmptr_dll;
331 /* no wide version in CRTDLL */
332
333 # endif /* __DECLSPEC_SUPPORTED */
334 #endif  /* CRTDLL */
335
336 /* This variable determines the default file mode.
337  * TODO: Which flags work?
338  */
339 #if !defined (__DECLSPEC_SUPPORTED) || defined (__IN_MINGW_RUNTIME)
340
341 #ifdef __MSVCRT__
342 #define _fmode  (*_imp___fmode)
343 extern int *_imp___fmode;
344 #else
345 /* CRTDLL */
346 #define _fmode  (*_imp___fmode_dll)
347 extern int *_imp___fmode_dll;
348 #endif
349
350 #else  /* __DECLSPEC_SUPPORTED */
351 #ifdef __MSVCRT__
352 __MINGW_IMPORT  int _fmode;
353
354 #else  /* ! __MSVCRT__ */
355 #define _fmode  _fmode_dll
356 __MINGW_IMPORT  int _fmode_dll;
357
358 #endif  /* !__MSVCRT__ */
359 #endif  /* __DECLSPEC_SUPPORTED */
360 #endif  /* !__STRICT_ANSI__ */
361
362 _CRTIMP __cdecl __MINGW_NOTHROW  int atoi (const char *);
363 _CRTIMP __cdecl __MINGW_NOTHROW  long atol (const char *);
364
365 _CRTIMP __cdecl __MINGW_NOTHROW  double strtod (const char *, char **);
366 _CRTIMP __cdecl __MINGW_NOTHROW  double atof (const char *);
367
368 #if !defined (__STRICT_ANSI__)
369 _CRTIMP __cdecl __MINGW_NOTHROW  double _wtof (const wchar_t *);
370 _CRTIMP __cdecl __MINGW_NOTHROW  int _wtoi (const wchar_t *);
371 _CRTIMP __cdecl __MINGW_NOTHROW  long _wtol (const wchar_t *);
372 #endif
373
374 #if __USE_MINGW_ANSI_STDIO
375 /* Microsoft's strtod() and atof() implementations, (in MSVCRT.DLL),
376  * mishandle infinities and NaNs; on the basis that this conditional
377  * exposes a more ISO-C conforming printf() I/O family implementaion,
378  * we substitute a similarly more conforming implementation for each
379  * of this pair of (somewhat related) functions.
380  *
381  * Note that we provide neither __JMPSTUB__ nor __LIBIMPL__ external
382  * equivalents for either of these two inline functions, because they
383  * would conflict with the runtime DLL implementations; users needing
384  * an address reference for either must provide an equivalent of the
385  * inline implementation, as non-inlined within their own code.
386  */
387 extern __cdecl __MINGW_NOTHROW
388 double __strtod (const char *__restrict__, char **__restrict__);
389
390 __CRT_ALIAS __cdecl __MINGW_NOTHROW
391 double strtod (const char *__restrict__ __nptr, char **__restrict__ __endptr)
392 { return __strtod( __nptr, __endptr ); }
393
394 __CRT_ALIAS __cdecl __MINGW_NOTHROW
395 double atof (const char *__nptr) { return __strtod( __nptr, NULL ); }
396
397 #endif  /* __USE_MINGW_ANSI_STDIO */
398
399 #ifdef _ISOC99_SOURCE
400 /* Irrespective of requested standards conformity, where MSVCRT.DLL
401  * falls short, ISO-C99 offers this pair of alternative return type
402  * specific variants of strtod(), which MSVCRT.DLL does not, but we
403  * do, in libmingwex.a:
404  */
405 __cdecl __MINGW_NOTHROW
406 float strtof (const char *__restrict__, char **__restrict__);
407
408 __cdecl __MINGW_NOTHROW
409 long double strtold (const char *__restrict__, char **__restrict__);
410 #endif  /* _ISOC99_SOURCE */
411
412 _CRTIMP __cdecl __MINGW_NOTHROW  long strtol (const char *, char **, int);
413 _CRTIMP __cdecl __MINGW_NOTHROW  unsigned long strtoul (const char *, char **, int);
414
415 #endif  /* _STDLIB_H only */
416 #if ! (defined _STDLIB_H && defined _WCHAR_H)
417 /* Prototypes which are to be declared both here, in <stdlib.h>,
418  * and also in <wchar.h>; declare them here, such that they may be
419  * selectively included by <wchar.h>.
420  */
421 _CRTIMP __cdecl __MINGW_NOTHROW
422 long wcstol (const wchar_t *, wchar_t **, int);
423
424 _CRTIMP __cdecl __MINGW_NOTHROW
425 unsigned long wcstoul (const wchar_t *, wchar_t **, int);
426
427 _CRTIMP __cdecl __MINGW_NOTHROW  double wcstod (const wchar_t *, wchar_t **);
428
429 /* The following MinGW specific alternatives to wcstod(), which may
430  * offer more robust performance than the MSVCRT.DLL implementation,
431  * are provided in libmingwex.a; (the float and long double variants
432  * are simply aliases for the ISO-C99 equivalents which follow).
433  */
434 __cdecl __MINGW_NOTHROW
435 double __mingw_wcstod (const wchar_t *__restrict__, wchar_t **__restrict__);
436
437 __cdecl __MINGW_NOTHROW
438 float __mingw_wcstof (const wchar_t *__restrict__, wchar_t **__restrict__);
439
440 __cdecl __MINGW_NOTHROW
441 long double __mingw_wcstold (const wchar_t *__restrict__, wchar_t **__restrict__);
442
443 #ifdef _ISOC99_SOURCE
444 /* Variants on wcstod(), specified by ISO-C99; once again, MSVCRT.DLL
445  * doesn't have them, but we offer them in libmingwex.a
446  */
447 __cdecl __MINGW_NOTHROW
448 float wcstof (const wchar_t *__restrict__, wchar_t **__restrict__);
449
450 __cdecl __MINGW_NOTHROW
451 long double wcstold (const wchar_t *__restrict__, wchar_t **__restrict__);
452 #endif  /* _ISOC99_SOURCE */
453
454 #ifdef __MSVCRT__
455 #if __MSVCRT_VERSION__ >= __MSVCR70_DLL || _WIN32_WINNT >= _WIN32_WINNT_WINXP
456 /* This pair of wide character equivalents for ISO-C99's strtoll() and
457  * strtoull() require either WinXP (or later), or a non-free MSVC runtime
458  * from MSVCR70.DLL onwards...
459  */
460 _CRTIMP __cdecl __MINGW_NOTHROW
461 __int64 _wcstoi64(const wchar_t *, wchar_t **, int);
462
463 _CRTIMP __cdecl __MINGW_NOTHROW
464 unsigned __int64 _wcstoui64(const wchar_t *, wchar_t **, int);
465
466 #endif  /* WinXP || MSVCR70.DLL || later */
467
468 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
469 /* ...while the following pair require Win-Vista (or later), or non-free
470  * MSVCRT runtime from MSVCR80.DLL onwards; they also require...
471  */
472 #ifndef __have_typedef_locale_t
473 /* ...this opaque data type, which we may obtain by selective inclusion
474  * from <locale.h>.  (Note that this may render them unusable for users of
475  * MSVCRT.DLL; see the explanation in <locale.h>, regarding the difficulty
476  * in creating, or otherwise acquiring a reference to, a _locale_t object,
477  * notwithstanding the availability of the functions in MSVCRT.DLL, from
478  * the release of Win-Vista onwards).
479  */
480 #define __need_locale_t
481 #include <locale.h>
482 #endif  /* !__have_typedef_locale_t */
483
484 _CRTIMP __cdecl __MINGW_NOTHROW
485 __int64 _wcstoi64_l(const wchar_t *, wchar_t **, int, _locale_t);
486
487 _CRTIMP __cdecl __MINGW_NOTHROW
488 unsigned __int64 _wcstoui64_l(const wchar_t *, wchar_t **, int, _locale_t);
489
490 #endif  /* Win-Vista || MSVCR80.DLL || later */
491
492 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_wgetenv (const wchar_t *);
493 _CRTIMP __cdecl __MINGW_NOTHROW  int _wputenv (const wchar_t *);
494
495 _CRTIMP __cdecl __MINGW_NOTHROW
496 void _wsearchenv (const wchar_t *, const wchar_t *, wchar_t *);
497
498 _CRTIMP __cdecl __MINGW_NOTHROW  int _wsystem (const wchar_t *);
499
500 _CRTIMP __cdecl __MINGW_NOTHROW
501 void _wmakepath (wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *,
502     const wchar_t *
503   );
504
505 _CRTIMP __cdecl __MINGW_NOTHROW
506 void _wsplitpath (const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
507
508 _CRTIMP __cdecl __MINGW_NOTHROW
509 wchar_t *_wfullpath (wchar_t *, const wchar_t *, size_t);
510
511 #endif  /* __MSVCRT__ */
512 #endif  /* _STDLIB_H || _WCHAR_H */
513
514 #ifdef _STDLIB_H  /* <stdlib.h> only */
515 _CRTIMP __cdecl __MINGW_NOTHROW  size_t wcstombs (char *, const wchar_t *, size_t);
516 _CRTIMP __cdecl __MINGW_NOTHROW  int wctomb (char *, wchar_t);
517
518 _CRTIMP __cdecl __MINGW_NOTHROW  int mblen (const char *, size_t);
519 _CRTIMP __cdecl __MINGW_NOTHROW  size_t mbstowcs (wchar_t *, const char *, size_t);
520 _CRTIMP __cdecl __MINGW_NOTHROW  int mbtowc (wchar_t *, const char *, size_t);
521
522 _CRTIMP __cdecl __MINGW_NOTHROW  int rand (void);
523 _CRTIMP __cdecl __MINGW_NOTHROW  void srand (unsigned int);
524
525 /* rand() is devoid of entropy, and is thus a mediocre pseudo-random number
526  * generator.  Microsoft do offer a better quality (bogusly dubbed as a more
527  * secure) PRNG, in the guise of rand_s(), but it
528  *
529  *   1) must be explicitly enabled, by user defined feature test macro;
530  */
531 #ifdef _CRT_RAND_S
532 /*
533  *   2) is not supported on Win9x, nor any WinNT version prior to WinXP;
534  *   3) on WinXP, requires linking with non-free MSVCR80.DLL, or later;
535  *   4) is provided by MSVCRT.DLL, only from Vista onward.
536  */
537 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
538
539 _CRTIMP __cdecl __MINGW_NOTHROW  int rand_s (unsigned int *);
540
541 #endif  /* Win-Vista || MSVCR80.DLL || later */
542 #endif  /* _CRT_RAND_S enabled */
543
544 _CRTIMP __cdecl __MINGW_NOTHROW  void abort (void) __MINGW_ATTRIB_NORETURN;
545 _CRTIMP __cdecl __MINGW_NOTHROW  void exit (int) __MINGW_ATTRIB_NORETURN;
546
547 /* Note: this is in startup code, not imported directly from the runtime DLL
548  */
549 int __cdecl __MINGW_NOTHROW atexit (void (*)(void));
550
551 _CRTIMP __cdecl __MINGW_NOTHROW  int system (const char *);
552 _CRTIMP __cdecl __MINGW_NOTHROW  char *getenv (const char *);
553
554 #ifndef __STRICT_ANSI__
555 /* For GNU compatibility, in addition to the standard memory allocation
556  * functions (declared below), we also include the non-standard alloca()
557  * API declarations here, in accordance with GNU convention.
558  */
559 # include "alloca.h"
560 #endif  /* !__STRICT_ANSI__ */
561
562 _CRTIMP __cdecl __MINGW_NOTHROW  void *calloc (size_t, size_t) __MINGW_ATTRIB_MALLOC;
563 _CRTIMP __cdecl __MINGW_NOTHROW  void *malloc (size_t) __MINGW_ATTRIB_MALLOC;
564 _CRTIMP __cdecl __MINGW_NOTHROW  void *realloc (void *, size_t);
565 _CRTIMP __cdecl __MINGW_NOTHROW  void free (void *);
566
567 /* The following pair of MinGW alternatives to realloc() and free() are
568  * always suitable as substitutes for their MSVCRT.DLL counterparts; the
569  * advantage of such substitutions is that these alternatives are able to
570  * operate on heap memory which has been allocated by the MinGW aligned
571  * memory allocation API functions, (but NOT the corresponding Microsoft
572  * functions), in addition to memory allocated by malloc() or calloc().
573  */
574 __cdecl __MINGW_NOTHROW  void *__mingw_realloc (void *, size_t);
575 __cdecl __MINGW_NOTHROW  void __mingw_free (void *);
576
577 /* Since MinGW's __mingw_free() and __mingw_realloc() are able to
578  * operate transparently on pointers returned by any of Microsoft's
579  * heap allocators, except their over-aligned variants, just as they
580  * operate on pointers returned by MinGW's over-aligned allocators,
581  * and all of ISO-C11, C++17, and POSIX.1 require this capability,
582  * always prefer these replacements for free() and realloc().
583  */
584 __JMPSTUB__(( LIB = memalign, FUNCTION = free ))
585 __CRT_ALIAS __cdecl __MINGW_NOTHROW  void free (void *__ptr)
586 { __mingw_free (__ptr); }
587
588 __JMPSTUB__(( LIB = memalign, FUNCTION = realloc ))
589 __CRT_ALIAS __cdecl __MINGW_NOTHROW  void *realloc (void *__ptr, size_t __want)
590 { return __mingw_realloc (__ptr, __want); }
591
592 #if __STDC_VERSION__ >= 201112L || __cplusplus >= 201703L
593 /* ISO-C99 adds support for over-aligned heap memory allocation, by use
594  * of the aligned_alloc() function, (which was subsequently incorporated
595  * into ISO-C++17 as std::aligned_alloc()); we may conveniently support
596  * this by use of MinGW's __mingw_aligned_offset_malloc(), which is
597  * nominally declared in <malloc.h>, and reproduced here:
598  */
599 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_MALLOC
600 void *__mingw_aligned_offset_malloc (size_t, size_t, size_t);
601
602 __CRT_ALIAS __LIBIMPL__(( LIB = memalign, FUNCTION = aligned_alloc ))
603
604 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_MALLOC
605 void *aligned_alloc (size_t __alignment, size_t __want)
606 { return __mingw_aligned_offset_malloc( __want, __alignment, (size_t)(0) ); }
607
608 /* For the ISO-C++17 case, we need to ensure that the feature test
609  * macro _GLIBCXX_HAVE_ALIGNED_ALLOC is defined, with non-zero value;
610  * (it is interpreted in <cstdlib>, but only for C++17 and later).
611  */
612 #undef  _GLIBCXX_HAVE_ALIGNED_ALLOC
613 #define _GLIBCXX_HAVE_ALIGNED_ALLOC  1
614 #endif  /* ISO-C11 || ISO-C++17 */
615
616 /* bsearch() and qsort() are declared both here, in <stdlib.h>, and in
617  * non-ANSI header <search.h>; we reproduce these declarations in both,
618  * with no attempt to guard them, so the compiler may verify that they
619  * are consistent, if both headers are included.
620  */
621 _CRTIMP __cdecl  void *bsearch
622 (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
623
624 _CRTIMP __cdecl  void qsort
625 (void *, size_t, size_t, int (*)(const void *, const void *));
626
627 _CRTIMP __cdecl __MINGW_NOTHROW  int abs (int) __MINGW_ATTRIB_CONST;
628 _CRTIMP __cdecl __MINGW_NOTHROW  long labs (long) __MINGW_ATTRIB_CONST;
629
630 /* div_t and ldiv_t are structures used to return the results of div()
631  * and ldiv() functions.
632  *
633  * NOTE: div() and ldiv() appear not to work correctly unless
634  *       -fno-pcc-struct-return is specified. This is included in the
635  *       mingw32 specs file.
636  */
637 typedef struct { int quot, rem; } div_t;
638 typedef struct { long quot, rem; } ldiv_t;
639
640 _CRTIMP __cdecl __MINGW_NOTHROW  div_t div (int, int) __MINGW_ATTRIB_CONST;
641 _CRTIMP __cdecl __MINGW_NOTHROW  ldiv_t ldiv (long, long) __MINGW_ATTRIB_CONST;
642
643 #if !defined __STRICT_ANSI__ || (defined _ISOC99_SOURCE && !defined __NO_INLINE__)
644 /* Although not nominally valid in "__STRICT_ANSI__" mode, when compiling C99
645  * source, we use Microsoft's _exit() function to facilitate our provision of
646  * an inline implementation of ISO-C99's _Exit() function.
647  */
648 _CRTIMP __cdecl __MINGW_NOTHROW  void _exit (int) __MINGW_ATTRIB_NORETURN;
649
650 #ifdef __MSVCRT__
651 /* Similarly, we use Microsoft's MSVCRT.DLL specific _atoi64() function,
652  * to facilitate an inline implementation of ISO-C99's atoll() function.
653  */
654 _CRTIMP __cdecl __MINGW_NOTHROW  __int64 _atoi64 (const char *);
655
656 #endif  /* __MSVCRT__ */
657 #endif  /* !__STRICT_ANSI__ || (_ISOC99_SOURCE && !__NO_INLINE__) */
658
659 #if !defined (__STRICT_ANSI__)
660 /* NOTE: Officially the three following functions are obsolete. The Win32 API
661  *       functions SetErrorMode, Beep and Sleep are their replacements.
662  */
663 _CRTIMP __cdecl __MINGW_NOTHROW  void _beep (unsigned int, unsigned int) __MINGW_ATTRIB_DEPRECATED;
664 /* Not to be confused with  _set_error_mode (int).  */
665 _CRTIMP __cdecl __MINGW_NOTHROW  void _seterrormode (int) __MINGW_ATTRIB_DEPRECATED;
666 _CRTIMP __cdecl __MINGW_NOTHROW  void _sleep (unsigned long) __MINGW_ATTRIB_DEPRECATED;
667
668 /* _onexit is a Microsoft extension. Use atexit for portability. */
669 /* Note: This is in startup code, not imported directly from dll */
670 typedef  int (* _onexit_t)(void);
671 __cdecl __MINGW_NOTHROW  _onexit_t _onexit( _onexit_t );
672
673 _CRTIMP __cdecl __MINGW_NOTHROW  int _putenv (const char *);
674 _CRTIMP __cdecl __MINGW_NOTHROW
675 void _searchenv (const char *, const char *, char *);
676
677 _CRTIMP __cdecl __MINGW_NOTHROW  char *_ecvt (double, int, int *, int *);
678 _CRTIMP __cdecl __MINGW_NOTHROW  char *_fcvt (double, int, int *, int *);
679 _CRTIMP __cdecl __MINGW_NOTHROW  char *_gcvt (double, int, char *);
680
681 _CRTIMP __cdecl __MINGW_NOTHROW
682 void _makepath (char *, const char *, const char *, const char *, const char *);
683
684 _CRTIMP __cdecl __MINGW_NOTHROW
685 void _splitpath (const char *, char *, char *, char *, char *);
686
687 _CRTIMP __cdecl __MINGW_NOTHROW  char *_fullpath (char*, const char*, size_t);
688
689 _CRTIMP __cdecl __MINGW_NOTHROW  char *_itoa (int, char *, int);
690 _CRTIMP __cdecl __MINGW_NOTHROW  char *_ltoa (long, char *, int);
691 _CRTIMP __cdecl __MINGW_NOTHROW  char *_ultoa(unsigned long, char *, int);
692 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_itow (int, wchar_t *, int);
693 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_ltow (long, wchar_t *, int);
694 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t *_ultow (unsigned long, wchar_t *, int);
695
696 #ifdef __MSVCRT__
697 _CRTIMP __cdecl __MINGW_NOTHROW  char* _i64toa (__int64, char *, int);
698 _CRTIMP __cdecl __MINGW_NOTHROW  char* _ui64toa (unsigned __int64, char *, int);
699 _CRTIMP __cdecl __MINGW_NOTHROW  __int64 _wtoi64 (const wchar_t *);
700 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t* _i64tow (__int64, wchar_t *, int);
701 _CRTIMP __cdecl __MINGW_NOTHROW  wchar_t* _ui64tow (unsigned __int64, wchar_t *, int);
702
703 _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int (_rotl)(unsigned int, int) __MINGW_ATTRIB_CONST;
704 _CRTIMP __cdecl __MINGW_NOTHROW  unsigned int (_rotr)(unsigned int, int) __MINGW_ATTRIB_CONST;
705 _CRTIMP __cdecl __MINGW_NOTHROW  unsigned long (_lrotl)(unsigned long, int) __MINGW_ATTRIB_CONST;
706 _CRTIMP __cdecl __MINGW_NOTHROW  unsigned long (_lrotr)(unsigned long, int) __MINGW_ATTRIB_CONST;
707
708 _CRTIMP __cdecl __MINGW_NOTHROW  int _set_error_mode (int);
709
710 # define _OUT_TO_DEFAULT        0
711 # define _OUT_TO_STDERR         1
712 # define _OUT_TO_MSGBOX         2
713 # define _REPORT_ERRMODE        3
714
715 # if __MSVCRT_VERSION__ >= __MSVCR80_DLL
716 #  ifndef _UINTPTR_T_DEFINED
717 #   define _UINTPTR_T_DEFINED
718 #   ifdef _WIN64
719       typedef unsigned __int64 uintptr_t;
720 #   else
721       typedef unsigned int uintptr_t;
722 #   endif
723 #  endif
724
725 _CRTIMP __cdecl __MINGW_NOTHROW
726 unsigned int _set_abort_behavior (unsigned int, unsigned int);
727
728 /* These masks work with msvcr80.dll version 8.0.50215.44 (a beta release).
729  */
730 #  define _WRITE_ABORT_MSG      1
731 #  define _CALL_REPORTFAULT     2
732
733 typedef void
734 (* _invalid_parameter_handler) (
735     const wchar_t *,
736     const wchar_t *,
737     const wchar_t *,
738     unsigned int,
739     uintptr_t);
740 _invalid_parameter_handler _set_invalid_parameter_handler (_invalid_parameter_handler);
741
742 # endif /* __MSVCRT_VERSION__ >= __MSVCR80_DLL */
743 #endif  /* __MSVCRT__ */
744
745 #ifndef _NO_OLDNAMES
746 _CRTIMP __cdecl __MINGW_NOTHROW  int putenv (const char*);
747 _CRTIMP __cdecl __MINGW_NOTHROW  void searchenv (const char*, const char*, char*);
748
749 _CRTIMP __cdecl __MINGW_NOTHROW  char* itoa (int, char*, int);
750 _CRTIMP __cdecl __MINGW_NOTHROW  char* ltoa (long, char*, int);
751
752 #ifndef _UWIN
753 _CRTIMP __cdecl __MINGW_NOTHROW  char* ecvt (double, int, int*, int*);
754 _CRTIMP __cdecl __MINGW_NOTHROW  char* fcvt (double, int, int*, int*);
755 _CRTIMP __cdecl __MINGW_NOTHROW  char* gcvt (double, int, char*);
756
757 #endif  /* ! _UWIN */
758 #endif  /* ! _NO_OLDNAMES */
759 #endif  /* ! __STRICT_ANSI__ */
760
761 #ifdef _ISOC99_SOURCE
762 /* Further APIs required to support ISO-C99, but missing from MSVCRT.DLL;
763  * we provide them in libmingwex.a:
764  *
765  * ISO-C99 name for _exit()
766  */
767 __cdecl __MINGW_NOTHROW  void _Exit(int) __MINGW_ATTRIB_NORETURN;
768
769 #ifndef __NO_INLINE__
770 __CRT_INLINE __JMPSTUB__(( FUNCTION = _Exit, REMAPPED = _exit ))
771 __cdecl __MINGW_NOTHROW  void _Exit( int __status ){ _exit (__status); }
772 #endif
773
774 typedef struct { long long quot, rem; } lldiv_t;
775 __cdecl __MINGW_NOTHROW  lldiv_t lldiv (long long, long long) __MINGW_ATTRIB_CONST;
776
777 __cdecl __MINGW_NOTHROW  long long llabs (long long);
778
779 #ifndef __NO_INLINE__
780 __CRT_INLINE
781 /* No JMPSTUB or LIBIMPL reference here -- we provide a free-standing
782  * implementation, along with imaxabs(), in mingwex/imaxabs.c
783  */
784 __cdecl __MINGW_NOTHROW  long long llabs( long long __j )
785 { return __j >= 0 ? __j : -__j; }
786 #endif
787
788 __cdecl __MINGW_NOTHROW
789 long long strtoll (const char *__restrict__, char **__restrict, int);
790
791 __cdecl __MINGW_NOTHROW
792 unsigned long long strtoull (const char *__restrict__, char **__restrict__, int);
793
794 #ifdef __MSVCRT__
795 /* MSVCRT.DLL does not provide ISO-C99's atoll() function, but it does
796  * provide an analogue, in _atoi64(); map it accordingly.
797  */
798 __cdecl __MINGW_NOTHROW  long long atoll (const char *);
799
800 #ifndef __NO_INLINE__
801 __CRT_INLINE __JMPSTUB__(( FUNCTION = atoll, REMAPPED = _atoi64 ))
802 __cdecl __MINGW_NOTHROW  long long atoll (const char * _c){ return _atoi64 (_c); }
803 #endif
804
805 #endif  /* __MSVCRT__ */
806 #endif  /* _ISOC99_SOURCE */
807
808 #if defined __MSVCRT__ && ! defined __STRICT_ANSI__
809 #if __MSVCRT_VERSION__ >= __MSVCR70_DLL || _WIN32_WINNT >= _WIN32_WINNT_WINXP
810 /* Microsoft specific alternatives to ISO-C99 strtoll() and strtoull(); the
811  * first pair require WinXP (or later) or non-free MSVCR70.DLL onwards...
812  */
813 _CRTIMP __cdecl __MINGW_NOTHROW
814 __int64 _strtoi64(const char*, char **, int);
815
816 _CRTIMP __cdecl __MINGW_NOTHROW
817 unsigned __int64 _strtoui64(const char*, char **, int);
818
819 #endif  /* WinXP || MSVCR70.DLL || later */
820 #if __MSVCRT_VERSION__ >= __MSVCR80_DLL || _WIN32_WINNT >= _WIN32_WINNT_VISTA
821 /* ...while the following pair require Win-Vista (or later), or non-free
822  * MSVCR80.DLL onwards; (note that, like their wide character counterparts,
823  * they may actually be unusable without MSVCR80.DLL onwards, because of
824  * the difficulty in acquiring a reference to a _locale_t object).
825  */
826 _CRTIMP __cdecl __MINGW_NOTHROW
827 __int64 _strtoi64_l(const char *, char **, int, _locale_t);
828
829 _CRTIMP __cdecl __MINGW_NOTHROW
830 unsigned __int64 _strtoui64_l(const char *, char **, int, _locale_t);
831
832 #endif  /* Win-Vista || MSVCR80.DLL || later */
833
834 /* Type long long analogues for MSVCRT.DLL specific type long functions;
835  * none are actually provided by any version of MSVCRT.DLL, with names as
836  * specified here, but rather as called by the inline functions used to
837  * implement them, (i.e. the REMAPPED name specified in each__JMPSTUB__
838  * function reference respectively).
839  *
840  * FIXME: Not one of these is specified by ISO-C99, nor by POSIX, either;
841  * is there really any justification for us to specify them at all?  For
842  * the time being, declare as deprecated; perhaps remove later?
843  */
844 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  long long wtoll (const wchar_t *);
845 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  char *lltoa (long long, char *, int);
846 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  char *ulltoa (unsigned long long , char *, int);
847 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  wchar_t *lltow (long long, wchar_t *, int);
848 __cdecl __MINGW_NOTHROW __MINGW_ATTRIB_DEPRECATED  wchar_t *ulltow (unsigned long long, wchar_t *, int);
849
850 #ifndef __NO_INLINE__
851 /* None of these functions would exist at all, without either these inline
852  * implementations, or their respective __JMPSTUB__ equivalents.
853  */
854 __CRT_INLINE __JMPSTUB__(( FUNCTION = lltoa, REMAPPED = _i64toa ))
855 __cdecl __MINGW_NOTHROW  char *lltoa (long long __n, char * __c, int __i)
856 { return _i64toa (__n, __c, __i); }
857
858 __CRT_INLINE __JMPSTUB__(( FUNCTION = ulltoa, REMAPPED = _ui64toa ))
859 __cdecl __MINGW_NOTHROW  char *ulltoa (unsigned long long __n, char * __c, int __i)
860 { return _ui64toa (__n, __c, __i); }
861
862 __CRT_INLINE __JMPSTUB__(( FUNCTION = wtoll, REMAPPED = _wtoi64 ))
863 __cdecl __MINGW_NOTHROW  long long wtoll (const wchar_t * __w){ return _wtoi64 (__w); }
864
865 __CRT_INLINE __JMPSTUB__(( FUNCTION = lltow, REMAPPED = _i64tow ))
866 __cdecl __MINGW_NOTHROW  wchar_t *lltow (long long __n, wchar_t * __w, int __i)
867 { return _i64tow (__n, __w, __i); }
868
869 __CRT_INLINE __JMPSTUB__(( FUNCTION = ulltow, REMAPPED = _ui64tow ))
870 __cdecl __MINGW_NOTHROW  wchar_t *ulltow (unsigned long long __n, wchar_t * __w, int __i)
871 { return _ui64tow (__n, __w, __i); }
872
873 #endif  /* ! __NO_INLINE__ */
874 #endif  /* __MSVCRT__ && ! __STRICT_ANSI__ */
875
876 /* POSIX/BSD extensions in libmingwex.a; these should be exposed only on
877  * the basis of appropriate POSIX or BSD specific feature tests...
878  *
879  * mkstemp(3) function support; added per feature request #2003.
880  * POSIX wants _XOPEN_SOURCE >= 500, (implying _POSIX_C_SOURCE >= 200112L).
881  */
882 #if _POSIX_C_SOURCE >= 200112L
883
884 __cdecl __MINGW_NOTHROW  int mkstemp (char *);
885 __cdecl __MINGW_NOTHROW  int __mingw_mkstemp (int, char *);
886
887 /* On POSIX platforms, programmers may adopt an idiom such as:
888  *
889  *   if( mkstemp( template ) >= 0 )
890  *   { unlink( template );
891  *     . . .
892  *   }
893  *
894  * to ensure that a temporary file does NOT persist after it is
895  * closed; MS-Windows does not allow such use of unlink(2), while
896  * the file remains open.  Thus, MS-Windows programmers must take
897  * extra care, to close and unlink temporary files AFTER use, if
898  * similar behaviour is desired.
899  *
900  * To mitigate this MS-Windows limitation, we provide support for
901  * an alternative, MinGW specific idiom:
902  *
903  *   #include <fcntl.h>
904  *
905  *   _MKSTEMP_SETMODE( _O_TEMPORARY );
906  *   if( mkstemp( template ) >= 0 )
907  *   {
908  *     . . .
909  *   }
910  *
911  * to achieve a similar effect to that of the above POSIX idiom; the
912  * following macros are a MinGW specific extension, to facilite such
913  * use of _O_TEMPORARY, (in addition to the POSIX required attributes),
914  * when creating the temporary file.  Note that they require <fcntl.h>,
915  * which <stdlib.h> should NOT automatically include; we leave it to
916  * the user to explicitly include it, if using _MKSTEMP_SETMODE.
917  */
918 #define _MKSTEMP_INVOKE       0
919 #define _MKSTEMP_DEFAULT     _O_CREAT | _O_EXCL | _O_RDWR
920 #define _MKSTEMP_SETMODE(M) __mingw_mkstemp( _MKSTEMP_DEFAULT | (M), NULL )
921
922 #ifndef _NO_OLDNAMES
923 #define MKSTEMP_SETMODE(M)  __mingw_mkstemp( _MKSTEMP_DEFAULT | (M), NULL )
924 #endif
925
926 __CRT_ALIAS __LIBIMPL__(( FUNCTION = mkstemp ))
927 __cdecl __MINGW_NOTHROW  int mkstemp (char *__filename_template)
928 { return __mingw_mkstemp( _MKSTEMP_INVOKE, __filename_template ); }
929
930 #endif  /* _POSIX_C_SOURCE >= 200112L (for mkstemp()) */
931
932 /* mkdtemp(3) function support: added as adjunct to feature request #2003.
933  * POSIX wants _XOPEN_SOURCE >= 700, (implying _POSIX_C_SOURCE >= 200809L).
934  */
935 #if _POSIX_C_SOURCE >= 200809L
936
937 __cdecl __MINGW_NOTHROW  char *mkdtemp (char *);
938 __cdecl __MINGW_NOTHROW  char *__mingw_mkdtemp (char *);
939
940 __CRT_ALIAS __JMPSTUB__(( FUNCTION = mkdtemp ))
941 __cdecl __MINGW_NOTHROW  char *mkdtemp (char *__dirname_template)
942 { return __mingw_mkdtemp( __dirname_template ); }
943
944 #endif  /* _POSIX_C_SOURCE >= 200809L (for mkdtemp()) */
945
946 #if _POSIX_C_SOURCE >= 200112L
947 /* setenv() and unsetenv() are also available, from POSIX.1-2001 onwards.
948  */
949 __cdecl __MINGW_NOTHROW  int setenv( const char *, const char *, int );
950 __cdecl __MINGW_NOTHROW  int unsetenv( const char * );
951
952 __cdecl __MINGW_NOTHROW  int __mingw_setenv( const char *, const char *, int );
953
954 __CRT_ALIAS __JMPSTUB__(( FUNCTION = setenv ))
955 __cdecl __MINGW_NOTHROW  int setenv( const char *__n, const char *__v, int __f )
956 { return __mingw_setenv( __n, __v, __f ); }
957
958 __CRT_ALIAS __LIBIMPL__(( FUNCTION = unsetenv ))
959 __cdecl __MINGW_NOTHROW  int unsetenv( const char *__name )
960 { return __mingw_setenv( __name, NULL, 1 ); }
961
962 #endif  /* _POSIX_C_SOURCE >= 200112L (for setenv()) */
963 #endif  /* _STDLIB_H */
964
965 _END_C_DECLS
966
967 #endif  /* ! RC_INVOKED */
968 #endif  /* ! _STDLIB_H: $RCSfile$: end of file */