[Issue 19151] New: std.utf.toUTF16z() can not be used for LPWSTR
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 9 08:17:53 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19151
Issue ID: 19151
Summary: std.utf.toUTF16z() can not be used for LPWSTR
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: StefanLiebig at web.de
The documentation of toUTF16z()
(https://dlang.org/phobos/std_utf.html#toUTF16z) says that it can be used for
LPWSTR or LPCWSTR.
When compiling:
auto success = CreateProcessW( null,
commandLine.toUTF16z(), // <- error
null,
null,
TRUE,
CREATE_UNICODE_ENVIRONMENT,
null,
null,
&startupInfo,
&processInfo );
I got the compile error:
source\process.d(32,32): Error: function
`core.sys.windows.winbase.CreateProcessW(const(wchar)*, wchar*,
SECURITY_ATTRIBUTES*, SECURITY_ATTRIBUTES*, int, uint, void*, const(wchar)*,
STARTUPINFOW*, PROCESS_INFORMATION*)` is not callable using argument types
`(typeof(null), const(wchar)*, typeof(null), typeof(null), int, uint,
typeof(null), typeof(null), STARTUPINFOW*, PROCESS_INFORMATION*)`
source\process.d(32,32): cannot pass argument
`toUTF16z(cast(const(char)[])commandLine)` of type `const(wchar)*` to parameter
`wchar*`
Casting the second parameter to LPWSTR works.
Using DMD 2.081.1
Maybe it relates to https://issues.dlang.org/show_bug.cgi?id=2275
--
More information about the Digitalmars-d-bugs
mailing list