Duplicate of http://stackoverflow.com/questions/683013/interop-sending-string-from-c-to-c
I want to send a string from C# to a function in a native C++ DLL.
Here is my code:
The C# side:
[DllImport(@"Native3DHandler.dll", EntryPoint = "#22", CharSet = CharSet.Unicode)]
private static extern void func1(string str);
public void func2(string str)
{
func1(str);
}
The C++ side:
void func1(wchar_t *path)
{
//...
}
What I get in the C++ side is an empty string, every time, no matter what I send. Help?
I already asked it here before, but I didn't get an answer that worked.
Thanks.