求助:C#调用c++的dll,字符串传递问题
1个回答
2017-01-19
展开全部
C#的定义
public static extern IntPtr run([MarshalAs(UnmanagedType.LPArray)]byte[] uml, [MarshalAs(UnmanagedType.LPArray)]byte[] name);
调用
byte[] buml = new byte[]{};
byte[] bname = new byte[]{};
string a="bcde";
string b="fghijk";
buml = System.Text.Encoding.ASCII.GetBytes(a);
bname = System.Text.Encoding.ASCII.GetBytes(b);
IntPtr intp = run(buml , bname );
public static extern IntPtr run([MarshalAs(UnmanagedType.LPArray)]byte[] uml, [MarshalAs(UnmanagedType.LPArray)]byte[] name);
调用
byte[] buml = new byte[]{};
byte[] bname = new byte[]{};
string a="bcde";
string b="fghijk";
buml = System.Text.Encoding.ASCII.GetBytes(a);
bname = System.Text.Encoding.ASCII.GetBytes(b);
IntPtr intp = run(buml , bname );
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询