https://blog.youkuaiyun.com/u010159842/article/details/51720458
添加:
1.c++参数含有&,c#也需要用ref关键字。
2.在c++中声明是char*,调用是char[];c#声明为Intptr,调用使用Marshal.AllocHGlobal(Size)为其赋值。记得释放分配的内存 Marshal.FreeHGlobal(stringPointer);
而在c#中获取这个值,使用Marshal.Copy(Intptr source.自定义类型 destination, sss, int copy起始位置, int 要copy的数目),destination即是。
本文介绍了C++与C#之间的互操作方法,包括如何处理引用类型的参数以及字符数组与指针的转换,提供了具体的示例和注意事项。
443

被折叠的 条评论
为什么被折叠?



