widl: Output UUID files compatible with older Visual C++ and MinGW (bug #7486)

Dan Hipschman dsh at linux.ucla.edu
Mon Sep 10 18:08:44 CDT 2007

This patch fixes the output of "widl -u" to be compatible with older versions
of Visual C++ and MinGW, which don't have the guiddef.h header.  This fixes
most of bug #7486, which also contained complaints about warnings from MinGW.
I cannot move "#define INITGUID" up above the includes of the RPC headers, as
this breaks stuff on Wine, and doesn't make any sense.  Defining INITGUID
tells the header (guiddef.h, or initguid.h on older systems) to include
definitions of the GUIDs, and this shouldn't be done in the included RPC
headers.  The problem looks like it's with MinGW's header file.

It should possibly be noted that the version of MIDL 5.01.0164 doesn't
include anything in the UUID file, it just defines the necessary types
directly, and initializes the GUIDs without macros.

 tools/widl/widl.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index cca1325..ca88958 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -396,8 +396,7 @@ int main(int argc,char *argv[])
     fprintf(idfile, "from %s - Do not edit ***/\n\n", input_name);
     fprintf(idfile, "#include <rpc.h>\n");
     fprintf(idfile, "#include <rpcndr.h>\n\n");
-    fprintf(idfile, "#define INITGUID\n");
-    fprintf(idfile, "#include <guiddef.h>\n\n");
+    fprintf(idfile, "#include <initguid.h>\n\n");
     fprintf(idfile, "#ifdef __cplusplus\n");
     fprintf(idfile, "extern \"C\" {\n");
     fprintf(idfile, "#endif\n\n");

More information about the wine-patches mailing list