crt: Provide __p__wpgmptr() function for VC20+ CRT import libraries Function __p__wpgmptr() returns pointer to global variable _wpgmptr and is available since VC20, it is available also in UCRT, and also in x86 version of OS system version msvcrt.dll. crtdll.dll and msvcrt10.dll do not provide global variable _wpgmptr and neither __p__wpgmptr() function. For remaining CRT import libraries (x64/arm32/arm64 msvcrt.dll) provide mingw-w64 version of __p__wpgmptr() function defined via global variable _wpgmptr. Global variable _wpgmptr is available in all CRT libraries except UCRT. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 1b2d993..2d1ccb7 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -468,6 +468,7 @@ misc/__p__pgmptr.c \ misc/__p__wcmdln.c \ misc/__p__wenviron.c \ + misc/__p__wpgmptr.c \ misc/_create_locale.c \ misc/_free_locale.c \ misc/_get_current_locale.c \ @@ -486,6 +487,7 @@ misc/__p__mbctype.c \ misc/__p__pgmptr.c \ misc/__p__wcmdln.c \ + misc/__p__wpgmptr.c \ misc/_getpid.c \ misc/initenv.c \ stdio/_fstat64i32.c \ @@ -589,6 +591,7 @@ misc/__p__mbctype.c \ misc/__p__pgmptr.c \ misc/__p__wcmdln.c \ + misc/__p__wpgmptr.c \ misc/_getpid.c \ misc/initenv.c \ stdio/_setmaxstdio.c \
diff --git a/mingw-w64-crt/misc/__p__wpgmptr.c b/mingw-w64-crt/misc/__p__wpgmptr.c new file mode 100644 index 0000000..5742236 --- /dev/null +++ b/mingw-w64-crt/misc/__p__wpgmptr.c
@@ -0,0 +1,17 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#include <_mingw.h> +#include <stddef.h> + +extern wchar_t** __MINGW_IMP_SYMBOL(_wpgmptr); + +wchar_t** __cdecl __p__wpgmptr(void); +wchar_t** __cdecl __p__wpgmptr(void) +{ + return __MINGW_IMP_SYMBOL(_wpgmptr); +} +wchar_t** (__cdecl *__MINGW_IMP_SYMBOL(__p__wpgmptr))(void) = __p__wpgmptr;