diff --git a/build/src/internal.h b/build/src/internal.h
index 11d117658b738b33f6ea7f0c95048e4de426d8b1..9fc4ccbe52917686a44f931fe80d2bdbe3c16749 100644
--- a/build/src/internal.h
+++ b/build/src/internal.h
@@ -187,13 +187,15 @@ typedef struct DIR {
   struct dirent  result;
 } DIR;
 
-#ifndef HAVE_POLL
 struct pollfd {
   SOCKET fd;
   short events;
   short revents;
 };
 #define POLLIN 1
+
+#ifdef HAVE_POLL
+#define poll(x, y, z)  WSAPoll((x), (y), (z))
 #endif
 
 
diff --git a/mongoose.c b/mongoose.c
index 93a7c75c732251ed153c74f7f7e371b455e44650..269c1e9e504aa703c43439316ef195beac263a4d 100644
--- a/mongoose.c
+++ b/mongoose.c
@@ -187,13 +187,15 @@ typedef struct DIR {
   struct dirent  result;
 } DIR;
 
-#ifndef HAVE_POLL
 struct pollfd {
   SOCKET fd;
   short events;
   short revents;
 };
 #define POLLIN 1
+
+#ifdef HAVE_POLL
+#define poll(x, y, z)  WSAPoll((x), (y), (z))
 #endif