diff options
Diffstat (limited to 'generic/tclIOSock.c')
-rw-r--r-- | generic/tclIOSock.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/generic/tclIOSock.c b/generic/tclIOSock.c index c5b7d28..b435dfa 100644 --- a/generic/tclIOSock.c +++ b/generic/tclIOSock.c @@ -283,6 +283,35 @@ TclCreateSocketAddress( } /* + * Work around an omission in earlier versions of MinGW. + */ +#ifdef __MINGW32__ +char* WSAAPI +gai_strerrorA(int ecode) +{ + static char message[1024+1]; + DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS + | FORMAT_MESSAGE_MAX_WIDTH_MASK; + DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); + FormatMessageA(dwFlags, NULL, ecode, dwLanguageId, (LPSTR)message, 1024, NULL); + return message; +} + +WCHAR* WSAAPI +gai_strerrorW(int ecode) +{ + static WCHAR message[1024+1]; + DWORD dwFlags = FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS + | FORMAT_MESSAGE_MAX_WIDTH_MASK; + DWORD dwLanguageId = MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT); + FormatMessageW(dwFlags, NULL, ecode, dwLanguageId, (LPWSTR)message, 1024, NULL); + return message; +} +#endif + +/* * Local Variables: * mode: c * c-basic-offset: 4 |