1 #include <windows.h>
2 #include <malloc.h>
3 #include <errno.h>
4 #include <msvcrt.h>
5 #include <sec_api/wchar_s.h>
6 
7 static int __cdecl _int_vcwprintf_s (const wchar_t *, va_list);
8 static int __cdecl _stub (const wchar_t *, va_list);
9 
10 int __cdecl (*__MINGW_IMP_SYMBOL(_vcwprintf_s))(const wchar_t *, va_list) =
11  _stub;
12 
13 static int __cdecl
_stub(const wchar_t * s,va_list argp)14 _stub (const wchar_t *s, va_list argp)
15 {
16   int __cdecl (*f)(const wchar_t *, va_list) = __MINGW_IMP_SYMBOL(_vcwprintf_s);
17 
18   if (f == _stub)
19     {
20 	f = (int __cdecl (*)(const wchar_t *, va_list))
21 	    GetProcAddress (__mingw_get_msvcrt_handle (), "_vcwprintf_s");
22 	if (!f)
23 	  f = _int_vcwprintf_s;
24 	__MINGW_IMP_SYMBOL(_vcwprintf_s) = f;
25     }
26   return (*f)(s, argp);
27 }
28 
29 int __cdecl
_vcwprintf_s(const wchar_t * s,va_list argp)30 _vcwprintf_s (const wchar_t *s, va_list argp)
31 {
32   return _stub (s, argp);
33 }
34 
35 static int __cdecl
_int_vcwprintf_s(const wchar_t * s,va_list argp)36 _int_vcwprintf_s (const wchar_t *s, va_list argp)
37 {
38   return _vcwprintf (s, argp);
39 }
40