using System.Runtime.InteropServices; [DllImport("user32.dll",EntryPoint="MessageBox",CharSet=CharSet.Auto)] public static extern int Msg( System.IntPtr hwnd, [MarshalAs(UnmanagedType.LPTStr)] string text, [MarshalAs(UnmanagedType.LPTStr)] string caption, int utype );
调用时和原型的参数前加 ref
我的dll中的函数是: int Read_Card(char* data); 功能: 从IC卡中读取数据并写在data所指向的内存
public static extern int Msg(
System.IntPtr hwnd,
[MarshalAs(UnmanagedType.LPTStr)]
string text,
[MarshalAs(UnmanagedType.LPTStr)]
string caption,
int utype
);
int Read_Card(char* data);
功能:
从IC卡中读取数据并写在data所指向的内存
ref int
和我的问题有何关系?请说具体点
char*:
[Out]StringBuider
http://community.csdn.net/Expert/topic/4909/4909159.xml?temp=.7286646
这是我那篇帖子,你可以参考一下
关键是StringBuilder这个类
public static void funcation(ref StringBuilder data)