From: Daniel P. Berrange Date: Thu, 21 Jun 2012 13:37:34 +0000 (+0100) Subject: winsock2.h must always be included before windows.h X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=931b7d194a7cf17f1d6eb0132fcbc52ee3c671a7;p=libvirt.git winsock2.h must always be included before windows.h Some GNULIB headers (eg unistd.h) will often need to include winsock2.h for various symbols. There is a rule that winsock2.h must be included before windows.h. This means that any file which does #ifdef WIN32 #include #endif #include is potentially broken. A simple rule is that /all/ includes of windows.h must be matched with a preceding include of winsock2.h regardless of whether unistd.h is used currently Signed-off-by: Daniel P. Berrange --- diff --git a/src/util/util.c b/src/util/util.c index ce98d206d6..f886ea7007 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -65,6 +65,9 @@ #endif #ifdef WIN32 +# ifdef HAVE_WINSOCK2_H +# include +# endif # include # include #endif diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c index b07d6a7ed8..68810fbf77 100644 --- a/src/vbox/vbox_MSCOMGlue.c +++ b/src/vbox/vbox_MSCOMGlue.c @@ -22,6 +22,9 @@ #include +#ifdef HAVE_WINSOCK2_H +# include +#endif #include #define nsCID CLSID