Here is a patch using WIN32_LEAN_AND_MEAN which tries not to break dsound (and vl.c). I could only test it using cross compilation from Linux, so please send comments.
Patch description: * add WIN32_LEAN_AND_MEAN to all inclusions of windows.h * remove windows.h from vl.c (it is already included otherwise) * add mmsystem.h to vl.c and dsoundaudio.c (they need it and got it from windows.h) * fixed indentation in vl.c (wrong indentation was caused by an earlier patch from me) It will be difficult to avoid using variable names like "interface" in the future, so I still think using a minimal set of includes is the better (and faster) solution. Anyway, Windows users need a working solution, so it would be nice if one of these patches could be applied to CVS HEAD. Thank you. Stefan JonY schrieb: > Stefan Weil wrote: >> basetyps.h is included by windows.h / rpc.h. QEMU does not need it, so >> you can avoid it like this: >> >> #define WIN32_LEAN_AND_MEAN >> #include <windows.h> >> >> WIN32_LEAN_AND_MEAN reduces the number of includes in windows.h >> and increases compilation speed. And you don't have to rename >> variables like interface :-) >> >> Regards, >> Stefan > > Hi, > > I would prefer Eduardo's patch, defining WIN32_LEAN_AND_MEAN breaks > dsound. > > Thanks. > > >
Index: qemu_socket.h =================================================================== RCS file: /sources/qemu/qemu/qemu_socket.h,v retrieving revision 1.2 diff -u -r1.2 qemu_socket.h --- qemu_socket.h 21 Dec 2006 19:46:43 -0000 1.2 +++ qemu_socket.h 13 Dec 2007 20:09:04 -0000 @@ -3,7 +3,7 @@ #define QEMU_SOCKET_H #ifdef _WIN32 - +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> Index: osdep.c =================================================================== RCS file: /sources/qemu/qemu/osdep.c,v retrieving revision 1.20 diff -u -r1.20 osdep.c --- osdep.c 18 Nov 2007 01:44:35 -0000 1.20 +++ osdep.c 13 Dec 2007 20:09:05 -0000 @@ -37,6 +37,7 @@ #include "sysemu.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #elif defined(_BSD) #include <stdlib.h> Index: vl.c =================================================================== RCS file: /sources/qemu/qemu/vl.c,v retrieving revision 1.379 diff -u -r1.379 vl.c --- vl.c 11 Dec 2007 23:23:51 -0000 1.379 +++ vl.c 13 Dec 2007 20:09:07 -0000 @@ -109,7 +109,7 @@ #ifdef _WIN32 #include <malloc.h> #include <sys/timeb.h> -#include <windows.h> +#include <mmsystem.h> #define getopt_long_only getopt_long #define memalign(align, size) malloc(size) #endif @@ -8937,7 +8937,7 @@ s->down_script[0]) launch_script(s->down_script, ifname, s->fd); } - } + } } #endif return 0; Index: tap-win32.c =================================================================== RCS file: /sources/qemu/qemu/tap-win32.c,v retrieving revision 1.7 diff -u -r1.7 tap-win32.c --- tap-win32.c 17 Nov 2007 17:14:38 -0000 1.7 +++ tap-win32.c 13 Dec 2007 20:09:07 -0000 @@ -30,6 +30,7 @@ #include "net.h" #include "sysemu.h" #include <stdio.h> +#define WIN32_LEAN_AND_MEAN #include <windows.h> /* NOTE: PCIBus is redefined in winddk.h */ Index: qemu-common.h =================================================================== RCS file: /sources/qemu/qemu/qemu-common.h,v retrieving revision 1.3 diff -u -r1.3 qemu-common.h --- qemu-common.h 19 Nov 2007 00:38:33 -0000 1.3 +++ qemu-common.h 13 Dec 2007 20:09:07 -0000 @@ -28,6 +28,7 @@ #endif #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #define fsync _commit #define lseek _lseeki64 Index: exec.c =================================================================== RCS file: /sources/qemu/qemu/exec.c,v retrieving revision 1.119 diff -u -r1.119 exec.c --- exec.c 12 Dec 2007 01:16:22 -0000 1.119 +++ exec.c 13 Dec 2007 20:09:08 -0000 @@ -19,6 +19,7 @@ */ #include "config.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #else #include <sys/types.h> Index: qemu-img.c =================================================================== RCS file: /sources/qemu/qemu/qemu-img.c,v retrieving revision 1.25 diff -u -r1.25 qemu-img.c --- qemu-img.c 11 Nov 2007 03:33:13 -0000 1.25 +++ qemu-img.c 13 Dec 2007 20:09:09 -0000 @@ -26,6 +26,7 @@ #include <assert.h> #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #endif Index: kqemu.c =================================================================== RCS file: /sources/qemu/qemu/kqemu.c,v retrieving revision 1.19 diff -u -r1.19 kqemu.c --- kqemu.c 17 Sep 2007 08:09:44 -0000 1.19 +++ kqemu.c 13 Dec 2007 20:09:09 -0000 @@ -19,6 +19,7 @@ */ #include "config.h" #ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN #include <windows.h> #include <winioctl.h> #else Index: audio/dsoundaudio.c =================================================================== RCS file: /sources/qemu/qemu/audio/dsoundaudio.c,v retrieving revision 1.4 diff -u -r1.4 dsoundaudio.c --- audio/dsoundaudio.c 17 Nov 2007 17:35:54 -0000 1.4 +++ audio/dsoundaudio.c 13 Dec 2007 20:09:09 -0000 @@ -32,7 +32,9 @@ #define AUDIO_CAP "dsound" #include "audio_int.h" +#define WIN32_LEAN_AND_MEAN #include <windows.h> +#include <mmsystem.h> #include <objbase.h> #include <dsound.h> Index: slirp/slirp.h =================================================================== RCS file: /sources/qemu/qemu/slirp/slirp.h,v retrieving revision 1.14 diff -u -r1.14 slirp.h --- slirp/slirp.h 7 Nov 2007 19:27:18 -0000 1.14 +++ slirp/slirp.h 13 Dec 2007 20:09:09 -0000 @@ -29,6 +29,7 @@ typedef uint64_t u_int64_t; typedef char *caddr_t; +#define WIN32_LEAN_AND_MEAN # include <windows.h> # include <winsock2.h> # include <sys/timeb.h>