sockets: fix Windows 2000 build (#450)

Commit 4630a5dab6 broke compilation for
Windows 2000 and earlier as getaddrinfo was introduced in Windows XP.
Fix this by including <wspiapi.h> when targeting Windows 2000 and
earlier, which falls back to an inline implementation of getaddrinfo
when necessary.
Some MinGW flavors still target Windows 2000 by default.

Ref:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms738520.aspx,
section "Support for getaddrinfo on Windows 2000 and older versions"
pull/461/head
Marcel Raad 2017-07-28 21:14:59 +02:00 committed by Jeffrey Walton
parent d44a81f91c
commit b5191dde6f
1 changed files with 4 additions and 1 deletions

View File

@ -30,8 +30,11 @@
# include <sanitizer/msan_interface.h>
#endif
#ifdef PREFER_WINDOWS_STYLE_SOCKETS
#ifdef USE_WINDOWS_STYLE_SOCKETS
# pragma comment(lib, "ws2_32.lib")
# if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x501)
# include <wspiapi.h>
# endif
#endif
NAMESPACE_BEGIN(CryptoPP)