Not all the variables that were listed seem to be exported from
ucrtbase though.

Signed-off-by: Martin Storsjö <mar...@martin.st>
---
 mingw-w64-headers/crt/stdlib.h | 45 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 43 insertions(+), 2 deletions(-)

diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
index 5af46e4..eca13de 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -161,9 +161,16 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void);
   extern char *_sys_errlist[];
   extern int _sys_nerr;
 #else
+#if __MSVCRT_VERSION__ >= 0x1400
+  _CRTIMP char **__cdecl __sys_errlist(void);
+  _CRTIMP int *__cdecl __sys_nerr(void);
+#define _sys_nerr (*__sys_nerr())
+#define _sys_errlist __sys_errlist();
+#else
   extern __declspec(dllimport) char *_sys_errlist[1];
   extern __declspec(dllimport) int _sys_nerr;
 #endif
+#endif
   _CRTIMP int *__cdecl __p___argc(void);
   _CRTIMP char ***__cdecl __p___argv(void);
   _CRTIMP wchar_t ***__cdecl __p___wargv(void);
@@ -171,6 +178,7 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void);
   _CRTIMP wchar_t ***__cdecl __p__wenviron(void);
   _CRTIMP char **__cdecl __p__pgmptr(void);
   _CRTIMP wchar_t **__cdecl __p__wpgmptr(void);
+  _CRTIMP int *__cdecl __p__fmode(void);
 
   errno_t __cdecl _get_pgmptr(char **_Value);
   errno_t __cdecl _get_wpgmptr(wchar_t **_Value);
@@ -229,7 +237,40 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void);
   extern unsigned int _winminor;
 #endif
 
-#else /* _MSVCRT_ */
+#elif __MSVCRT_VERSION__ >= 0x1400
+
+#ifndef __argc
+#define __argc (* __p___argc())
+#endif
+#ifndef __argv
+#define __argv (* __p___argv())
+#endif
+#ifndef __wargv
+#define __wargv (* __p___wargv())
+#endif
+
+#ifndef _POSIX_
+#ifndef _environ
+#define _environ (* __p__environ())
+#endif
+
+#ifndef _wenviron
+#define _wenviron (* __p__wenviron())
+#endif
+#endif /* !_POSIX_ */
+
+#ifndef _pgmptr
+#define _pgmptr (* __p__pgmptr())
+#endif
+
+#ifndef _wpgmptr
+#define _wpgmptr (* __p__wpgmptr())
+#endif
+#ifndef _fmode
+#define _fmode (* __p__fmode())
+#endif
+
+#else /* __MSVCRT_VERSION__ >= 0x1400 */
 
 #ifndef __argc
   extern int * __MINGW_IMP_SYMBOL(__argc);
@@ -295,7 +336,7 @@ _CRTIMP int __cdecl ___mb_cur_max_func(void);
 #define _winminor (* __MINGW_IMP_SYMBOL(_winminor))
 #endif
 
-#endif /* !_MSVCRT_ */
+#endif /* !_MSVCRT_ && __MSVCRT_VERSION__ < 0x1400 */
 
   errno_t __cdecl _get_osplatform(unsigned int *_Value);
   errno_t __cdecl _get_osver(unsigned int *_Value);
-- 
2.7.4


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to