Hi all,
I'd like to submit a patch which makes widl output forward declarations to the header file for coclass definitions. Currently this is done only if the coclass has its own forward declaration. For example,
[ uuid(...) ] coclass Foo; [ uuid(...) ] coclass Bar { ... };
Foo will get declared (via typedef) in the header but Bar will not. The only problem is that when I fix widl it breaks the build in three places:
make[2]: Entering directory `/var/build/wine/dlls/mshtml' In file included from conpoint.c:33: mshtml_private.h:99: error: conflicting types for `HTMLDocument' ../../include/mshtml.h:26023: error: previous declaration of `HTMLDocument' was here
make[2]: Entering directory `/var/build/wine/dlls/shdocvw' In file included from classinfo.c:26: shdocvw.h:133: error: conflicting types for `WebBrowser' ../../include/exdisp.h:1907: error: previous declaration of `WebBrowser' was here shdocvw.h:143: error: conflicting types for `InternetExplorer' ../../include/exdisp.h:1918: error: previous declaration of `InternetExplorer' was here
The problem is that the three names are declared coclasses in the IDL files which generates code like this:
#ifndef __Foo_FWD_DEFINED__ #define __Foo_FWD_DEFINED__ typedef struct Foo Foo; #endif /* defined __Foo_FWD_DEFINED__ */
and is included in the files shown above which redeclare the names like this:
typedef struct { ... } Foo;
There's actually an easy fix if we just change the latter declaration to
struct Foo { ... };
but I'm not sure this is not a kludge. Do the names really represent the same types, or is a namespace collision?
Thanks, Dan
Dan Hipschman wrote:
Hi all,
I'd like to submit a patch which makes widl output forward declarations to the header file for coclass definitions. Currently this is done only if the coclass has its own forward declaration. For example,
[ uuid(...) ] coclass Foo; [ uuid(...) ] coclass Bar { ... };
Foo will get declared (via typedef) in the header but Bar will not. The only problem is that when I fix widl it breaks the build in three places:
make[2]: Entering directory `/var/build/wine/dlls/mshtml' In file included from conpoint.c:33: mshtml_private.h:99: error: conflicting types for `HTMLDocument' ../../include/mshtml.h:26023: error: previous declaration of `HTMLDocument' was here
There's actually an easy fix if we just change the latter declaration to
struct Foo { ... };
but I'm not sure this is not a kludge. Do the names really represent the same types, or is a namespace collision?
This is just a namespace collision. A safer option might be to rename use FooImpl instead of Foo in the typedefs in mshtml_private.h and shdocvw.h, but your solution looks fine.
Dan Hipschman wrote:
Hi all,
I'd like to submit a patch which makes widl output forward declarations to the header file for coclass definitions. Currently this is done only if the coclass has its own forward declaration. For example,
[ uuid(...) ] coclass Foo; [ uuid(...) ] coclass Bar { ... };
Foo will get declared (via typedef) in the header but Bar will not. The only problem is that when I fix widl it breaks the build in three places:
make[2]: Entering directory `/var/build/wine/dlls/mshtml' In file included from conpoint.c:33: mshtml_private.h:99: error: conflicting types for `HTMLDocument' ../../include/mshtml.h:26023: error: previous declaration of `HTMLDocument' was here
make[2]: Entering directory `/var/build/wine/dlls/shdocvw' In file included from classinfo.c:26: shdocvw.h:133: error: conflicting types for `WebBrowser' ../../include/exdisp.h:1907: error: previous declaration of `WebBrowser' was here shdocvw.h:143: error: conflicting types for `InternetExplorer' ../../include/exdisp.h:1918: error: previous declaration of `InternetExplorer' was here
The problem is that the three names are declared coclasses in the IDL files which generates code like this:
#ifndef __Foo_FWD_DEFINED__ #define __Foo_FWD_DEFINED__ typedef struct Foo Foo; #endif /* defined __Foo_FWD_DEFINED__ */
IMO these forward declarations are useless and wrong. coclasses should not have a defined type as it's up to the developer how it will be implemented and clients should not use this type, but an interfaces instead. But it's only my opinion and if forward declarations are in midl, it should be fixed in widl.
and is included in the files shown above which redeclare the names like this:
typedef struct { ... } Foo;
There's actually an easy fix if we just change the latter declaration to
struct Foo { ... };
It seams to be the best solution.
Jacek