1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-24 22:50:26 +03:00

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 <windows.h>
  #endif
  #include <unistd.h>

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 <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2012-06-21 14:37:34 +01:00
parent 6a714d31d0
commit 931b7d194a
2 changed files with 6 additions and 0 deletions

View File

@ -65,6 +65,9 @@
#endif
#ifdef WIN32
# ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
# endif
# include <windows.h>
# include <shlobj.h>
#endif

View File

@ -22,6 +22,9 @@
#include <config.h>
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif
#include <windows.h>
#define nsCID CLSID