diff --git a/gio/gsocket.c b/gio/gsocket.c
index f144674..08d70a7 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -1929,7 +1929,7 @@ g_socket_bind (GSocket         *socket,
   return TRUE;
 }
 
-#if !defined(HAVE_IF_NAMETOINDEX) && defined(G_OS_WIN32)
+#if !defined(HAVE_IF_NAMETOINDEX) && defined(G_OS_WIN32) &&  !defined(__MINGW32__)
 static guint
 if_nametoindex (const gchar *iface)
 {
