Hi all.

somehow, for me, the following is against the "DMD philosophy", because this code builds successfully with DMD and the executable gives the expected result... but also the below strange messages...

CODE:
-----

    module main;

    import std.stdio;
    import std.c.windows.windows;

    pragma(lib, "user32.lib");
    pragma(lib, "Advapi32");


    void main(string[] args)
    {
        WCHAR lpwszUsername[254];
debug writefln("lpwszUsername.sizeof is %s, WCHAR.sizeof is %s", lpwszUsername.sizeof, WCHAR.sizeof);
        // DWORD dUsername2 = lpwszUsername.sizeof / WCHAR.sizeof;
        DWORD dUsername2 = 254;
        GetUserNameW(lpwszUsername.ptr, &dUsername2);
        writefln("Welcome userW %s", lpwszUsername);
        writeln();
    }

build command:
--------------
- dmd -v -w  main.d

OUTPUT incl. "ERROR":
---------------------

core.exception.UnicodeException@src\rt\util\utf.d(400): illegal UTF-16 value
    ----------------
    0x0041022C
    0x004074B7
    0x004074A1
    0x00406E66
    0x00406DCF
    0x00406D28
    0x00406C41
    0x00406828
    0x0040678C
    0x0040B66E
    0x0040B643
    0x0040B559
    0x00408737
    0x754D338A in BaseThreadInitThunk
    0x7714BF32 in RtlInitializeExceptionChain
    0x7714BF05 in RtlInitializeExceptionChain
    Welcome userW <my account name here>

environment:
------------
- DMD32 D Compiler v2.066.0
- Win7 Enterprise, SP1, 64bit


Any ideas?

Reply via email to