crt: Provide emulation of ___lc_handle_func for msvcrt.dll and msvcrtd.dll
Ensure that the ___lc_handle_func symbol is available for all builds which
uses msvcrt.dll and msvcrtd.dll runtime DLLs. ___lc_handle_func() emulation
uses the global __lc_handle variable which is present in all msvcrt.dll and
msvcrtd.dll versions.
Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index a296bd8..6cabe04 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -549,6 +549,7 @@
misc/msvcrt__getmainargs.c \
misc/msvcrt__wgetmainargs.c \
math/i386__copysignf.c \
+ misc/___lc_handle_func.c \
misc/___mb_cur_max_func.c \
misc/__p__osplatform.c \
misc/__pctype_func.c \
@@ -1013,6 +1014,7 @@
$(src_pre_msvcr100) \
$(src_pre_msvcr110) \
$(src_pre_msvcr120) \
+ misc/___lc_handle_func.c \
misc/msvcrt__getmainargs.c \
misc/msvcrt__wgetmainargs.c
diff --git a/mingw-w64-crt/lib-common/msvcrt.def.in b/mingw-w64-crt/lib-common/msvcrt.def.in
index 2565bcc..a7bb31f 100644
--- a/mingw-w64-crt/lib-common/msvcrt.def.in
+++ b/mingw-w64-crt/lib-common/msvcrt.def.in
@@ -1192,7 +1192,7 @@
F_I386(__CxxUnregisterExceptionObject)
__DestructExceptionObject
F_NON_I386(___lc_codepage_func) ; i386 ___lc_codepage_func replaced by emu
-___lc_handle_func
+F_NON_I386(___lc_handle_func) ; i386 ___lc_handle_func replaced by emu
F_NON_I386(___mb_cur_max_func) ; i386 ___mb_cur_max_func replaced by emu
F_X86_ANY(___setlc_active_func)
F_X86_ANY(___unguarded_readlc_active_add_func)
diff --git a/mingw-w64-crt/misc/___lc_handle_func.c b/mingw-w64-crt/misc/___lc_handle_func.c
new file mode 100644
index 0000000..fad5ba9
--- /dev/null
+++ b/mingw-w64-crt/misc/___lc_handle_func.c
@@ -0,0 +1,22 @@
+/**
+ * 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 <locale.h>
+#include <windows.h>
+
+extern LCID *__MINGW_IMP_SYMBOL(__lc_handle);
+
+static LCID *__cdecl emu____lc_handle_func(void)
+{
+ return __MINGW_IMP_SYMBOL(__lc_handle);
+}
+
+LCID *__cdecl ___lc_handle_func(void);
+#define RETT LCID*
+#define FUNC ___lc_handle_func
+#define ARGS void
+#define CALL
+#include "msvcrt_or_emu_glue.h"