Normally calling code should use the right version of headers, but the getopt implementation in libmingwex will have a hardcoded reference to __imp___argv.
This allows using getopt while linking to ucrtbase. Signed-off-by: Martin Storsjö <mar...@martin.st> --- mingw-w64-crt/crt/ucrtbase_compat.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mingw-w64-crt/crt/ucrtbase_compat.c b/mingw-w64-crt/crt/ucrtbase_compat.c index 404d1ac..ca872de 100644 --- a/mingw-w64-crt/crt/ucrtbase_compat.c +++ b/mingw-w64-crt/crt/ucrtbase_compat.c @@ -73,6 +73,7 @@ _CRTIMP int __cdecl _initialize_wide_environment(void); _CRTIMP int __cdecl _configure_narrow_argv(int mode); _CRTIMP int __cdecl _configure_wide_argv(int mode); +char*** __MINGW_IMP_SYMBOL(__argv); // Wrappers with legacy msvcrt.dll style API, based on the new ucrtbase.dll functions. @@ -85,6 +86,7 @@ int __cdecl __getmainargs(int * _Argc, char *** _Argv, char ***_Env, int _DoWild *_Env = *__p__environ(); __set_app_type(_StartInfo->newmode); __MINGW_IMP_SYMBOL(_acmdln) = __p__acmdln(); + __MINGW_IMP_SYMBOL(__argv) = __p___argv(); return 0; } @@ -97,6 +99,7 @@ int __cdecl __wgetmainargs(int * _Argc, wchar_t *** _Argv, wchar_t ***_Env, int *_Env = *__p__wenviron(); __set_app_type(_StartInfo->newmode); __MINGW_IMP_SYMBOL(_wcmdln) = (char**) __p__wcmdln(); + __MINGW_IMP_SYMBOL(__argv) = __p___argv(); return 0; } -- 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