Passing an array of strings from C# to C++ DLL function and fill it in the DLL and get back
问题 I am writing a C# application that passes an empty string array of size 30 to a C++ DLL. This string array needs to be filled in the DLL and given back to the C# application. I my code I observe memory corruption at the end of function call from DLL. My C++ DLL code is as follows: SAMPLEDLL_API BOOL InitExecution (wchar_t **paszStrings, int count) { for (int i = 0 ; i < count; i++) { mbstowcs(*(paszStrings + i), "Good",4); //*(paszStrings + i) = "Good"; } return TRUE; } My C# code is string[]