So in D I have a struct like this:
struct ProcessResult { string[] output; bool ok; }
in order to use output from C WINAPI with unicode, I need to convert each string to wchar* so that i can acess it from C with wchar_t*. Is that right or am I missing anything?
struct ProcessResult { string[] output; bool ok; C_ProcessResult toCResult() { auto r = C_ProcessResult(); r.ok = this.ok; // just copy, no conversion needed foreach(s; this.output) r.output ~= cast(wchar*)s.ptr; return r; } }
version(Windows) extern(C) export struct C_ProcessResult { wchar*[] output; bool ok; }