1 /** 2 * This file has no copyright assigned and is placed in the Public Domain. 3 * This file is part of the mingw-w64 runtime package. 4 * No warranty is given; refer to the file DISCLAIMER.PD within this package. 5 */ 6 7 #include <windows.h> 8 #include <locale.h> 9 #include <msvcrt.h> 10 11 static void __cdecl init_func(_locale_t locale); 12 void (__cdecl *__MINGW_IMP_SYMBOL(_free_locale))(_locale_t) = init_func; 13 stub_func(_locale_t locale)14static void __cdecl stub_func(_locale_t locale) 15 { 16 (void)locale; 17 } 18 init_func(_locale_t locale)19static void __cdecl init_func(_locale_t locale) 20 { 21 HMODULE msvcrt = __mingw_get_msvcrt_handle(); 22 void (__cdecl *func)(_locale_t) = NULL; 23 24 if (msvcrt) 25 func = (void*)GetProcAddress(msvcrt, "_free_locale"); 26 27 if (!func) 28 func = stub_func; 29 30 (__MINGW_IMP_SYMBOL(_free_locale) = func)(locale); 31 } 32