• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <windows.h>
2 #include <locale.h>
3 #include <msvcrt.h>
4 
5 static _locale_t __cdecl init_func(void);
6 _locale_t (__cdecl *__MINGW_IMP_SYMBOL(_get_current_locale))(void) = init_func;
7 
null_func(void)8 static _locale_t __cdecl null_func(void)
9 {
10   return NULL;
11 }
12 
init_func(void)13 static _locale_t __cdecl init_func(void)
14 {
15     HMODULE msvcrt = __mingw_get_msvcrt_handle();
16     _locale_t (__cdecl *func)(void) = NULL;
17 
18     if (msvcrt) {
19         func = (void*)GetProcAddress(msvcrt, "_get_current_locale");
20     }
21 
22     if (!func)
23         func = null_func;
24 
25     return (__MINGW_IMP_SYMBOL(_get_current_locale) = func)();
26 }
27