I want to send a string from C # to a function in my native C ++ DLL.
Here is my code: C # Side:
[DllImport(@"Native3DHandler.dll", EntryPoint = "#22",
CharSet = CharSet.Unicode)]
private static extern void func1(byte[] path);
public void func2(string path)
{
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] arr = encoding.GetBytes(path);
func1(this.something, arr);
}
C ++ side:
void func1(char *path)
{
}
What I get on the C ++ side is an empty string, every time, no matter what I send. Help?
Thank.
Malki
source
share