Next: , Previous: Library version handling, Up: Miscellaneous Notes


6.6 Windows sockets

There are several issues when building applications that should work under Windows. The most problematic part is for applications that use sockets.

Hopefully, we can add helpful notes to this section that will help you port your application to Windows using gnulib.

6.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.