*.idl: Use correct type for BSTR strings in the defaultvalue() statements.

Dmitry Timoshkov dmitry at baikal.ru
Fri Nov 6 05:02:11 CST 2015

Nikolay Sivov <bunglehead at gmail.com> wrote:

> > This matches midl/PSDK syntax, and allows to use Wine headers for compiling
> > applications with a C++ win32/win64 compiler. In order to be usable by C++
> > unix compilers widl needs to emit appropriate statically initialized WCHAR
> > strings, but that's a different problem, currently the generated Wine headers
> > with default(BSTR) statements can't be used with C++ at all.
> >
> Where do you see this? Mshtml.idl from Windows 10 SDK doesn't use this 
> notation, and in fact only fsrm*.idl files do, so it's not a common 
> practice.

midl has a built-in "magic" for handling defaultvalue() for BSTR strings,
that's why PSDK headers are not consistent in that regard: some of them
use defaultvalue("") while others use defaultvalue(L""). But using this
magic is not necessary if the header uses appropriate type for the default
value. So fixing an .idl should be preferrable IMO to adding support for
magic behaviour to widl.

> Generated headers should use L"", like you said. But only in 
> case of empty strings.

midl always generates L"" syntax, regardless whether it's an empty string
or not.

> Also leaving this broken for everything that's 
> not PSDK compiler doesn't sound right.

mingw/borland/any other wine32 compiler also benefit from this change.
It doesn't make sense to have it broken at all, but at least fixing
the .idl side of breakage should be considered as the first step, and
make the generated headers actually usable for the win32 platform.


More information about the wine-devel mailing list