I am trying to pass a string from c# to c++ it works perfectly but c++ only gets the first character of the string
C# Code:
[DllImport("IDEDLL.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
static extern void DirCreate(string name);
DirCreate(text1.Text);
C++ Code:
extern "C"{
__declspec(dllexport) void DirCreate(const char *path)
{
std::cout << path << std::endl;
}
}
Example:
Input: Hello!
Output: H