wchar_t* doSomething(wchar_t* src1, wchar_t* src2){
//...
wchar_t* result = new wchar_t[n];
//...
return result;
}
void deleteString(wchar_t* s) {
delete[] s;
}
//....
IntPtr pResult = doSomething(str1, str2);
var result = Marshal.PtrToStringUni(pResult);
deleteString(pResult);
//....