On Wednesday, 9 December 2020 at 20:35:21 UTC, Jack wrote:
I'm on linux/opensuse, trying to pass a wchar_* from C to D but I'm getting only the first letter of that string. Could someone help figure out why?

[...]


May be this help to you:

        auto s2 = to!string(s);
to
        auto s2 = fromWChar( s );

wstring fromWChar( const wchar* s )
{
    import std.conv : to;
    return s[ 0 .. wcslen( s ) ].to!wstring;
}


Example: https://run.dlang.io/is/PkCeTZ

Reply via email to