[PATCH 2/2] include: Define C++ operators inside extern "C++" blocks.

Octavian Voicu octavian.voicu at gmail.com
Fri Sep 3 12:44:29 CDT 2010


Fixes errors when compiling with wineg++ and including the files from
extern "C" blocks (eg. from include files generated by widl).
---
 include/guiddef.h    |   16 +++++++++-------
 include/propkeydef.h |   16 +++++++++-------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/include/guiddef.h b/include/guiddef.h
index f079983..9a2a941 100644
--- a/include/guiddef.h
+++ b/include/guiddef.h
@@ -107,13 +107,15 @@ typedef GUID FMTID,*LPFMTID;
 
 #if defined(__cplusplus) && !defined(CINTERFACE)
 #include <string.h>
-inline bool operator==(const GUID& guidOne, const GUID& guidOther)
-{
-    return !memcmp(&guidOne,&guidOther,sizeof(GUID));
-}
-inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
-{
-    return !(guidOne == guidOther);
+extern "C++" {
+    inline bool operator==(const GUID& guidOne, const GUID& guidOther)
+    {
+        return !memcmp(&guidOne,&guidOther,sizeof(GUID));
+    }
+    inline bool operator!=(const GUID& guidOne, const GUID& guidOther)
+    {
+        return !(guidOne == guidOther);
+    }
 }
 #endif
 
diff --git a/include/propkeydef.h b/include/propkeydef.h
index 2a796ea..a0e4f75 100644
--- a/include/propkeydef.h
+++ b/include/propkeydef.h
@@ -58,13 +58,15 @@
 #ifndef _PROPERTYKEY_EQUALITY_OPERATORS_
 #define _PROPERTYKEY_EQUALITY_OPERATORS_
 #ifdef __cplusplus
-inline bool operator==(REFPROPERTYKEY guidOne, REFPROPERTYKEY guidOther)
-{
-    return IsEqualPropertyKey(guidOne, guidOther);
-}
-inline bool operator!=(REFPROPERTYKEY guidOne, REFPROPERTYKEY guidOther)
-{
-    return !(guidOne == guidOther);
+extern "C++" {
+    inline bool operator==(REFPROPERTYKEY guidOne, REFPROPERTYKEY guidOther)
+    {
+        return IsEqualPropertyKey(guidOne, guidOther);
+    }
+    inline bool operator!=(REFPROPERTYKEY guidOne, REFPROPERTYKEY guidOther)
+    {
+        return !(guidOne == guidOther);
+    }
 }
 #endif
 #endif
-- 
1.7.0.4




More information about the wine-patches mailing list