Are you sure that the call requires the string to be null terminated? I do not know that winapi function, but this might work:bool test(HDC dc, string str, SIZE* s) { auto wstr = to!(wchar[])str; GetTextExtentPoint32W(dc, wstr.ptr, wstr.length, s); ...
It doesn't need to be null-terminated for that function. Shouldn't you use to!wstring though?!