摘要: 在合作开发时,C#时常需要调用C++DLL,当传递参数时时常遇到问题,尤其是传递和返回字符串是,现总结一下,分享给大家:VC++中主要字符串类型为:LPSTR,LPCSTR, LPCTSTR, string, CString, LPCWSTR, LPWSTR等但转为C#类型却不完全相同。主要有如下几种转换:将string转为IntPtr:IntPtr System.Runtime.InteropServices.Marshal.StringToCoTaskMemAuto(string)将IntPtr转为string:string System.Runtime.InteropServices.M 阅读全文
posted @ 2012-05-25 09:07 浪子の无悔 阅读(41097) 评论(3) 推荐(3) 编辑