Next: , Previous: , Up: Native Windows Support   [Contents][Index]


14.6 Windows sockets

One of the portability problems for native Windows are sockets and networking functions.

14.6.1 Getaddrinfo and WINVER

This was written for the getaddrinfo module, but may be applicable to other functions too.

The getaddrinfo function exists in ws2tcpip.h and -lws2_32 on Windows XP. The function declaration is present if WINVER >= 0x0501. Windows 2000 does not have getaddrinfo in its WS2_32.DLL.

Thus, if you want to assume Windows XP or later, you can add AC_DEFINE([WINVER], [0x0501]) to avoid compiling the (partial) getaddrinfo implementation.

If you want to support Windows 2000, don’t do anything. The replacement function will open WS2_32.DLL during run-time to see if there is a getaddrinfo function available, and use it when available.