From 1f5a876d329d9a8a76ec6a64dcd9de679ef966e6 Mon Sep 17 00:00:00 2001 From: Vaclav Slavik Date: Mon, 15 Jun 2015 13:52:50 +0200 Subject: [PATCH] Really fix MinGW compilation of SetThreadUILanguage-using code 09e1fbe fixed compilation, but not linking. Just use the same code as on the 3.0 branch, with dynamic loading of SetThreadUILanguage. --- src/common/intl.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/intl.cpp b/src/common/intl.cpp index 5202dabef7..d53978cb20 100644 --- a/src/common/intl.cpp +++ b/src/common/intl.cpp @@ -49,9 +49,8 @@ #endif #ifdef __WIN32__ + #include "wx/dynlib.h" #include "wx/msw/private.h" - // Some compilers' winnls.h header doesn't declare this function: - extern "C" WINBASEAPI LANGID WINAPI SetThreadUILanguage(LANGID LangId); #endif #include "wx/file.h" @@ -479,7 +478,12 @@ bool wxLocale::Init(int language, int flags) // behavior, so avoid calling it there. if ( wxGetWinVersion() >= wxWinVersion_Vista ) { - SetThreadUILanguage(LANGIDFROMLCID(lcid)); + wxLoadedDLL dllKernel32(wxS("kernel32.dll")); + typedef LANGID(WINAPI *SetThreadUILanguage_t)(LANGID); + SetThreadUILanguage_t pfnSetThreadUILanguage = NULL; + wxDL_INIT_FUNC(pfn, SetThreadUILanguage, dllKernel32); + if (pfnSetThreadUILanguage) + pfnSetThreadUILanguage(LANGIDFROMLCID(lcid)); } #endif