Marshall c#字符串到c++; 我想知道如何将C++字符串转换成一个本地C++ car *。我试过了,但似乎什么都没用。谢谢。
记住,C++ char实际上是一个字节,因此需要使用像之类的字节将它传递给字节[]。Marshall c#字符串到c++; 我想知道如何将C++字符串转换成一个本地C++ car *。我试过了,但似乎什么都没用。谢谢。,c#,marshalling,C#,Marshalling,记住,C++ char实际上是一个字节,因此需要使用像之类的字节将它传递给字节[]。 string str; // Contains string to pass to C++ DLL byte[] bytes = Encoding.UTF8.GetBytes(str); MyFun(bytes); // Call the C++ function with the string 另请参阅以获取不同的透视图。可能的重复项通常不需要这样做-您通常应该能够将函数声明为使用System.String
string str; // Contains string to pass to C++ DLL
byte[] bytes = Encoding.UTF8.GetBytes(str);
MyFun(bytes); // Call the C++ function with the string
另请参阅以获取不同的透视图。可能的重复项通常不需要这样做-您通常应该能够将函数声明为使用System.String参数。