WSAPoll & MinGW

For some reason if you try to use WSAPoll, you’ll get this fine error on linking:

poll.c:(.text+0x26): undefined reference to `WSAPoll’

Yeah.

Turns out that it’s basically missing from the includes.  Thanks to this hint, just simply add this into your source/header after pulling in winsock2.h and it’ll link.

typedef struct pollfd {
SOCKET fd;
SHORT events;
SHORT revents;
} WSAPOLLFD, *PWSAPOLLFD, FAR *LPWSAPOLLFD;
WINSOCK_API_LINKAGE int WSAAPI WSAPoll(LPWSAPOLLFD fdArray, ULONG fds, INT timeout);

And now you can happily compile and link.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.