Marshall char** to string problem calling unmanaged code from managed code
问题 I've this C++ function, bool MyClass::my_function(int num, TCHAR** filepath) I've expose the function as extern "C" { __declspec(dllexport) bool MyFunction(int num, char* filepath[]) { OutputDebugStringA("--MyFunction--"); TCHAR **w_filepath = (TCHAR **)calloc(num, 2* sizeof(TCHAR **)); for(int i = 0; i < num; i++) { OutputDebugStringA(filepath[i]); int len = strlen(filepath[i]) + 1; w_filepath[i] = (TCHAR *)calloc (1, len); ctow(w_filepath[i], filepath[i]); // converts char to WCHAR } bool