I have a function which signature is:
int __cdecl foo(IN int argc, IN wchar_t* args[], IN OUT wstring& output)
I am trying to invoke this function using PInvoke
and to print the result populated into output. However, I only get invalid characters.
The function was already tested using C++CLI
and I could print the results just fine after doing a conversion in the C++CLI
layer, so it’s not it’s execution who causes the problem, it’s the invocation.
If necessary, but only if no direct solution exists, I can create another native function with a more appropriate signature that will call the foo function and transform it’s output before returning it to C#.