1 #define _CRTIMP
2 #include <windows.h>
3 
4 typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t);
5 static _invalid_parameter_handler handler;
6 
mingw_set_invalid_parameter_handler(_invalid_parameter_handler new_handler)7 static _invalid_parameter_handler __cdecl mingw_set_invalid_parameter_handler(_invalid_parameter_handler new_handler)
8 {
9     return InterlockedExchangePointer((void**)&handler, new_handler);
10 }
11 
12 _invalid_parameter_handler (__cdecl *__MINGW_IMP_SYMBOL(_set_invalid_parameter_handler))(_invalid_parameter_handler) =
13     mingw_set_invalid_parameter_handler;
14 
mingw_get_invalid_parameter_handler(void)15 static _invalid_parameter_handler __cdecl mingw_get_invalid_parameter_handler(void)
16 {
17     return handler;
18 }
19 
20 _invalid_parameter_handler (__cdecl *__MINGW_IMP_SYMBOL(_get_invalid_parameter_handler))(void) = mingw_get_invalid_parameter_handler;
21 
22 _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void) __attribute__ ((alias ("mingw_get_invalid_parameter_handler")));
23 _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler new_handler) __attribute__ ((alias ("mingw_set_invalid_parameter_handler")));
24