c#调用c++的dll
我现在在用c#调用一个c++写的DLL
c++的范例是这样的
char ver[32] = "";
JBC7K2_Version(ver, ip, port)
ip是string类型
port是int类型
我在c#中调用怎么老出错
[DllImport("JBC7200A", EntryPoint = "JBC7K2_Version", CharSet = CharSet.Auto)]
public static extern int JBC7K2_Version(ref char[] ver, string ip, int port);
protected void Button3_Click(object sender, EventArgs e)
{
char[] ver = getbyte1(32);
try
{
JBC7K2DLL.JBC7K2_OpenSocket();
int i = JBC7K2DLL.JBC7K2_Version(ref ver, "172.16.1.233", 5101);
this.TextBox5.Text = i.ToString().Trim();
}
finally
{
JBC7K2DLL.JBC7K2_CloseSocket();
}
}
在綫等 谢谢各位大佬