Simplified COM interface declarations, removing the need to define
both an xxx_METHODS and an xxx_IMETHODS macro.
diff --git a/include/objbase.h b/include/objbase.h
index 12ed88d..f0588b9 100644
--- a/include/objbase.h
+++ b/include/objbase.h
@@ -75,15 +75,13 @@
*
* #define INTERFACE IDirect3D
* #define IDirect3D_METHODS \
+ * IUnknown_METHODS \
* STDMETHOD(Initialize)(THIS_ REFIID) PURE; \
* STDMETHOD(EnumDevices)(THIS_ LPD3DENUMDEVICESCALLBACK, LPVOID) PURE; \
* STDMETHOD(CreateLight)(THIS_ LPDIRECT3DLIGHT*, IUnknown*) PURE; \
* STDMETHOD(CreateMaterial)(THIS_ LPDIRECT3DMATERIAL*, IUnknown*) PURE; \
* STDMETHOD(CreateViewport)(THIS_ LPDIRECT3DVIEWPORT*, IUnknown*) PURE; \
* STDMETHOD(FindDevice)(THIS_ LPD3DFINDDEVICESEARCH, LPD3DFINDDEVICERESULT) PURE;
- * #define IDirect3D_IMETHODS \
- * IUnknown_IMETHODS \
- * IDirect3D_METHODS
* ICOM_DEFINE(IDirect3D,IUnknown)
* #undef INTERFACE
*
@@ -107,16 +105,12 @@
* name everywhere. Note however that because of the way macros work, a macro like STDMETHOD
* cannot use 'INTERFACE##_VTABLE' because this would give 'INTERFACE_VTABLE' and not
* 'IDirect3D_VTABLE'.
- * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the
- * inherited methods to form ICOM_IMETHODS.
- * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must
+ * - ICOM_METHODS defines the list of methods that are inheritable from this interface. It must
* be written manually (rather than using a macro to generate the equivalent code) to avoid
- * macro recursion (which compilers don't like).
+ * macro recursion (which compilers don't like). It must start with the METHODS definition
+ * of the parent interface so that method inheritance works properly.
* - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to
* explicitly use the interface name for macro expansion reasons again.
- * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's
- * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance
- * is taken care of by the language.
* - The 'undef INTERFACE' is here to remind you that using INTERFACE in the following macros
* will not work.
* - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access
@@ -166,7 +160,7 @@
* the user needs to know to use the interface. Of course the structure we will define to
* implement this interface will have more fields but the first one will match this pointer.
* - The code generated by ICOM_DEFINE defines both the structure representing the interface and
- * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to
+ * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_METHODS macro to
* automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS
* to define the IDirect3D methods.
* - Each method is declared as a pointer to function field in the jump table. The implementation
@@ -258,13 +252,6 @@
#define BEGIN_INTERFACE
#define END_INTERFACE
-/* Wine-specific macros */
-
-#define ICOM_DEFINE(iface,ibase) \
- DECLARE_INTERFACE_(iface,ibase) { \
- iface##_METHODS \
- } ICOM_COM_INTERFACE_ATTRIBUTE;
-
#else /* __cplusplus && !CINTERFACE */
/* C interface */
@@ -302,14 +289,12 @@
#define BEGIN_INTERFACE
#define END_INTERFACE
+#endif /* __cplusplus && !CINTERFACE */
+
/* Wine-specific macros */
#define ICOM_DEFINE(iface,ibase) \
- DECLARE_INTERFACE_(iface,ibase) { \
- ICOM_MSVTABLE_COMPAT_FIELDS \
- ibase##_IMETHODS \
- iface##_METHODS \
- };
+ DECLARE_INTERFACE_(iface,ibase) { iface##_METHODS } ICOM_COM_INTERFACE_ATTRIBUTE;
#define ICOM_VTABLE(iface) iface##Vtbl
#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl
@@ -320,8 +305,6 @@
#define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field))
#define ICOM_CTHIS_MULTI(impl,field,iface) const impl* const This=(const impl*)((char*)(iface) - offsetof(impl,field))
-#endif /* __cplusplus && !CINTERFACE */
-
#include "objidl.h"
#ifndef RC_INVOKED