On Wed, 7 Oct 2015, Dmitry Timoshkov wrote: [...]
diff --git a/programs/oleview/typelib.c b/programs/oleview/typelib.c index 21e9d96..d07dd3c 100644 --- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -18,6 +18,8 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSUNION
That this is needed to compile with the PSDK but not with Wine probably indicates a bug in the Wine headers. What was the compilation error?
Francois Gouget fgouget@free.fr wrote:
--- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -18,6 +18,8 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSUNION
That this is needed to compile with the PSDK but not with Wine probably indicates a bug in the Wine headers. What was the compilation error?
..\include\wine/debug.h(334) : error C2039: 'brecVal' : is not a member of 'tagVARIANT'
On Tue, 27 Oct 2015, Dmitry Timoshkov wrote:
Francois Gouget fgouget@free.fr wrote:
--- a/programs/oleview/typelib.c +++ b/programs/oleview/typelib.c @@ -18,6 +18,8 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSUNION
That this is needed to compile with the PSDK but not with Wine probably indicates a bug in the Wine headers. What was the compilation error?
..\include\wine/debug.h(334) : error C2039: 'brecVal' : is not a member of 'tagVARIANT'
The Wine header looks ok.
When you say you compile with the PSDK do you mean with the Visual C++ compiler?
I suspect the issue has to do with the __STDC__ and/or _FORCENAMELESSUNION defines. When given the /Za option the Visual C++ compiler defines __STDC__. But that should still work.
However there's a bug in the Microsoft headers because the V_UNION() definition does not take into account _FORCENAMELESSUNION. Is _FORCENAMELESSUNION defined in your compilation? What is the compiler command line?
Francois Gouget fgouget@free.fr wrote:
..\include\wine/debug.h(334) : error C2039: 'brecVal' : is not a member of 'tagVARIANT'
The Wine header looks ok.
When you say you compile with the PSDK do you mean with the Visual C++ compiler?
I guess that the compiler shipped with PSDK is a flavour of Visual C++ one.
I suspect the issue has to do with the __STDC__ and/or _FORCENAMELESSUNION defines. When given the /Za option the Visual C++ compiler defines __STDC__. But that should still work.
However there's a bug in the Microsoft headers because the V_UNION() definition does not take into account _FORCENAMELESSUNION. Is _FORCENAMELESSUNION defined in your compilation?
_FORCENAMELESSUNION is not defined neither explicitely nor implicitely. I've added a check #if defined(_FORCENAMELESSUNION) #error _FORCENAMELESSUNION #endif and it doesn't fire.
What is the compiler command line?
cl -o oleview.exe -W3 -O2 -D_X86_ -D__i386__ -Dinline=__inline -c typelib.c
Dmitry Timoshkov dmitry@baikal.ru wrote:
What is the compiler command line?
cl -o oleview.exe -W3 -O2 -D_X86_ -D__i386__ -Dinline=__inline -c typelib.c
I typed that looking at the screen of the nearby Windows box, and had to simplify things a bit. In case you need full compilation information here is complete contents of build.bat file used for compilation:
call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /x86 /xp /Release set NO_WARN=-D_X86_ -D__i386__ -Dinline=__inline -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_OBSOLETE_NO_WARNINGS del oleview.exe rc -r oleview.rc cl %NO_WARN% -o oleview.exe -W3 -O2 -I. -I..\include details.c interface.c oleview.c pane.c tree.c typelib.c oleview.res user32.lib gdi32.lib ole32.lib oleaut32.lib advapi32.lib comctl32.lib comdlg32.lib shell32.lib uuid.lib
On Tue, 27 Oct 2015, Francois Gouget wrote: [...]
That this is needed to compile with the PSDK but not with Wine probably indicates a bug in the Wine headers. What was the compilation error?
..\include\wine/debug.h(334) : error C2039: 'brecVal' : is not a member of 'tagVARIANT'
I found the problem. In debug.h we have V_UNION(v,brecVal).pvRecord and V_UNION(v,brecVal).pRecInfo. This does not work if tagVARIANT is using nameless unions such as with the Visual C++ compiler.
The reason it works in Wine is that __STDC__ is always defined so that Wine code never uses nameless unions for tagVARIANT. So I'm sending a fix for that (adding V_RECORD() and V_RECORDINFO()).
With that fix, are the following defines still needed? If yes, what is the compiler command line and error?
--- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -19,6 +19,9 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSSTRUCT +#define NONAMELESSUNION
Francois Gouget fgouget@free.fr wrote:
That this is needed to compile with the PSDK but not with Wine probably indicates a bug in the Wine headers. What was the compilation error?
..\include\wine/debug.h(334) : error C2039: 'brecVal' : is not a member of 'tagVARIANT'
I found the problem. In debug.h we have V_UNION(v,brecVal).pvRecord and V_UNION(v,brecVal).pRecInfo. This does not work if tagVARIANT is using nameless unions such as with the Visual C++ compiler.
The reason it works in Wine is that __STDC__ is always defined so that Wine code never uses nameless unions for tagVARIANT. So I'm sending a fix for that (adding V_RECORD() and V_RECORDINFO()).
With that fix, are the following defines still needed? If yes, what is the compiler command line and error?
--- a/dlls/oleaut32/tests/typelib.c +++ b/dlls/oleaut32/tests/typelib.c @@ -19,6 +19,9 @@
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define NONAMELESSSTRUCT +#define NONAMELESSUNION
I haven't seen your patch yet, but after adding V_RECORD() and V_RECORDINFO() from PSDK to Wine's include/oleauto.h the error while compiling oleview has gone, and the above defines in the dlls/oleaut32/tests/typelib.c are no longer needed.
Thanks!