Folks,
Why do we need to define _FORCENAMELESSUNION to get nameless unions in oleauto.h? Is this a standard feature, or is it just another Wine extension? Can someone please check the Windows headers to see how struct tagVARIANT is defined? Our is as follows:
struct tagVARIANT { union { struct __tagVARIANT { VARTYPE vt; WORD wReserved1; WORD wReserved2; WORD wReserved3; union /* DUMMYUNIONNAME */ { /* By value. */ CHAR cVal; USHORT uiVal; ULONG ulVal; INT intVal; UINT uintVal; BYTE bVal; short iVal; long lVal; float fltVal; double dblVal; VARIANT_BOOL boolVal; SCODE scode; DATE date; BSTR bstrVal; CY cyVal; IUnknown* punkVal; IDispatch* pdispVal; SAFEARRAY* parray;
/* By reference */ CHAR* pcVal; USHORT* puiVal; ULONG* pulVal; INT* pintVal; UINT* puintVal; BYTE* pbVal; short* piVal; long* plVal; float* pfltVal; double* pdblVal; VARIANT_BOOL* pboolVal; SCODE* pscode; DATE* pdate; BSTR* pbstrVal; VARIANT* pvarVal; PVOID byref; CY* pcyVal; DECIMAL* pdecVal; IUnknown** ppunkVal; IDispatch** ppdispVal; SAFEARRAY** pparray; } __VARIANT_NAME_3; } __VARIANT_NAME_2; DECIMAL decVal; } __VARIANT_NAME_1; };
On Sun, 22 Dec 2002, Dimitrie O. Paun wrote:
Folks,
Why do we need to define _FORCENAMELESSUNION to get nameless unions in oleauto.h? Is this a standard feature, or is it just another Wine extension?
It's a standard MS feature, and Wine defines VARIANT exactly like Windows. Perhaps the problem is more that MS defines __STDC__ only in "strict ANSI C compatibility without nameless unions mode" or something, and mingw defines it always? Perhaps you could investigate the mingw headers to see if they've changed the #ifs around to get around this. If you come up with something, I could make the necessary changes to my coming-soon oaidl.idl.
On December 22, 2002 06:03 am, Ove Kaaven wrote:
Perhaps you could investigate the mingw headers to see if they've changed the #ifs around to get around this.
This is how they do it:
#ifdef NONAMELESSUNION #define __VARIANT_NAME_1 n1 #define __VARIANT_NAME_2 n2 #define __VARIANT_NAME_3 n3 #define __VARIANT_NAME_4 n4 #else #define __tagVARIANT #define __VARIANT_NAME_1 #define __VARIANT_NAME_2 #define __VARIANT_NAME_3 #define __VARIANT_NAME_4 #endif
Maybe our way is the right way. But it seems like wxWindows expects nameless structures under all compilers, without defining _FORCENAMELESSUNION... I can just define it, it's not a big deal, just a small incompatibility.
Many things to fix, I'll get to it later on.
On Sun, 22 Dec 2002, Dimitrie O. Paun wrote:
On December 22, 2002 06:03 am, Ove Kaaven wrote:
Perhaps you could investigate the mingw headers to see if they've changed the #ifs around to get around this.
This is how they do it:
#ifdef NONAMELESSUNION #define __VARIANT_NAME_1 n1 #define __VARIANT_NAME_2 n2 #define __VARIANT_NAME_3 n3 #define __VARIANT_NAME_4 n4 #else #define __tagVARIANT #define __VARIANT_NAME_1 #define __VARIANT_NAME_2 #define __VARIANT_NAME_3 #define __VARIANT_NAME_4 #endif
Maybe our way is the right way. But it seems like wxWindows expects nameless structures under all compilers, without defining _FORCENAMELESSUNION... I can just define it, it's not a big deal, just a small incompatibility.
Maybe you should submit patches to wxWindows and/or MinGW. I think this could only improve these projects to be more compatible with the Windows headers...
On December 22, 2002 02:22 pm, Francois Gouget wrote:
Maybe you should submit patches to wxWindows and/or MinGW. I think this could only improve these projects to be more compatible with the Windows headers...
Well, but of course, I just want to make sure I fix the right thing. You see, I don't have the any MS devel stuff, so I have to ask if our implementation is correct or not. If it is, a fix we'll go to the other projects, don't worry :)
On Sun, 22 Dec 2002, Dimitrie O. Paun wrote:
Folks,
Why do we need to define _FORCENAMELESSUNION to get nameless unions in oleauto.h? Is this a standard feature, or is it just another Wine extension? Can someone please check the Windows headers to see how struct tagVARIANT is defined? Our is as follows:
_FORCENAMELESSUNION is a Windows 'feature' (checked against the latest SDK afaik). We do it like they do. Our variant type matches the Windows one except for tiny differences (e.g. short instead of SHORT) and we lack the __tagBRECORD field. I can send a patch to add these (tomorrow, it's late here).
On Sun, 22 Dec 2002, Francois Gouget wrote:
On Sun, 22 Dec 2002, Dimitrie O. Paun wrote:
Folks,
Why do we need to define _FORCENAMELESSUNION to get nameless unions in oleauto.h? Is this a standard feature, or is it just another Wine extension? Can someone please check the Windows headers to see how struct tagVARIANT is defined? Our is as follows:
_FORCENAMELESSUNION is a Windows 'feature' (checked against the latest SDK afaik). We do it like they do. Our variant type matches the Windows one except for tiny differences (e.g. short instead of SHORT) and we lack the __tagBRECORD field. I can send a patch to add these (tomorrow, it's late here).
BRECORD is already in my oaidl.idl (should be submitted sometime after the holidays), so it's not necessary.