poll: fix link error on native Windows
(too old to reply)
Bruno Haible
2017-05-10 23:09:30 UTC
Raw Message
On mingw (and similarly MSVC), I'm getting this link error:

i686-w64-mingw32-gcc -g -O2 -L/usr/local/mingw32/lib -o test-poll.exe test-poll.o libtests.a ../gllib/libgnu.a libtests.a -lws2_32 -lws2_32
../gllib/libgnu.a(poll.o): In function `windows_compute_revents_socket':
../../gllib/poll.c:250: undefined reference to `recv_used_without_requesting_gnulib_module_recv'

This fixes it:

2017-05-10 Bruno Haible <***@clisp.org>

poll: Fix link error on native Windows.
* lib/poll.c [WINDOWS_NATIVE]: Undefine recv.

diff --git a/lib/poll.c b/lib/poll.c
index 9115bcd..c4b2127 100644
--- a/lib/poll.c
+++ b/lib/poll.c
@@ -76,6 +76,10 @@


+/* Here we need the recv() function from Windows, that takes a SOCKET as
+ first argument, not any possible gnulib override. */
+# undef recv
static BOOL IsConsoleHandle (HANDLE h)
DWORD mode;