crt: Add emulation of _get_pgmptr() function for pre-msvcr80 import libs Function _get_pgmptr() is available in msvcr80+, UCRT and also in i386 and x64 msvcrt.dll since Windows Vista. It is not available in arm msvcrt.dll. Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index fa08d16..8a8bb10 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am
@@ -334,6 +334,7 @@ misc/_configthreadlocale.c \ misc/_get_daylight.c \ misc/_get_dstbias.c \ + misc/_get_pgmptr.c \ misc/_get_timezone.c \ misc/_get_tzname.c \ misc/_recalloc.c \ @@ -884,6 +885,7 @@ misc/_get_daylight.c \ misc/_get_dstbias.c \ misc/_get_errno.c \ + misc/_get_pgmptr.c \ misc/_get_timezone.c \ misc/_get_tzname.c \ misc/_initterm_e.c \
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in index 3f1b1a8..270dfd3 100644 --- a/mingw-w64-crt/lib-common/msvcrt.def.in +++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1433,7 +1433,7 @@ F_X86_ANY(_get_osplatform) F_X86_ANY(_get_osver) F_ARM_ANY(_get_output_format) ; i386 and x64 _get_output_format replaced by emu -F_X86_ANY(_get_pgmptr) +; F_X86_ANY(_get_pgmptr) ; i386 and x64 _get_pgmptr replaced by emu, arm32 and arm64 provided by emu _get_wenviron F_X86_ANY(_get_winmajor) F_X86_ANY(_get_winminor)
diff --git a/mingw-w64-crt/misc/_get_pgmptr.c b/mingw-w64-crt/misc/_get_pgmptr.c new file mode 100644 index 0000000..b13e21a --- /dev/null +++ b/mingw-w64-crt/misc/_get_pgmptr.c
@@ -0,0 +1,20 @@ +/** + * 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 <stdlib.h> +#include <errno.h> + +errno_t __cdecl _get_pgmptr(char **value) +{ + if (!value) + { + errno = EINVAL; + return EINVAL; + } + + *value = _pgmptr; + return 0; +} +errno_t (__cdecl *__MINGW_IMP_SYMBOL(_get_pgmptr))(char **) = _get_pgmptr;