www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.dwt - Build errors with recent checkout

Just did an update of DWT for the first time in a long time and got
these errors building the dwt-win library:

dwt\graphics\TextLayout.d(135): function
dwt.internal.win32.WINAPI.IIDFromString (wchar*,byte*) does not match
parameter types (char*,byte*)
dwt\graphics\TextLayout.d(135): Error: cannot implicitly convert
expression (cast(char*)toCharArray("{275c23e2-3747-11d0-9fea-00aa003f8646}\x00"))
of type char* to wchar*
dwt\graphics\TextLayout.d(136): function
dwt.internal.win32.WINAPI.IIDFromString (wchar*,byte*) does not match
parameter types (char*,byte*)
dwt\graphics\TextLayout.d(136): Error: cannot implicitly convert
expression (cast(char*)toCharArray("{DCCFC162-2B38-11d2-B7EC-00C04F8F5D9A}\x00"))
of type char* to wchar*

I'm using the released Tango 0.99.7 version built from source.

These lines that are the source of the error appear to be incorrect.


OS.IIDFromString("{275c23e2-3747-11d0-9fea-00aa003f8646}\0".toCharArray().ptr,
CLSID_CMultiLanguage.ptr);

IIDFromString takes a wide char string in the Win32 api, and
toCharArray from dwthelper\utils.d is returning a regular char[].

One fix would be to make a new "toWCharArray" function in utils.d,
with body like this:

public wchar[] toWCharArray( String str ){
    return toString16(str);
}

Then use that in TextLayout instead of toCharArray.  Or just stick the
toString16 directly in TextLayout.

--bb
Sep 08 2008