请教各位前辈:有一Delphi编写Dll
Delphi中调用如下:
function Init; external DLLNAME; TTraceProc = procedure(Msg: PChar); stdcall;
TMOProc = procedure(SrcAddr: PChar; Msg: PChar); stdcall;
function Init(ip: PChar; Port: Word; User: PChar; Pswd: PChar; Queue: PChar; QueueSize: Integer; Trace: TTraceProc; MO: TMOProc): Integer; stdcall;
C#如何调用?
[ DllImport(DLLNAME, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
public static extern int Init(string ip, ushort Port, string User, string Pswd, string Queue, int QueueSize,???, ???);
Delphi中调用如下:
function Init; external DLLNAME; TTraceProc = procedure(Msg: PChar); stdcall;
TMOProc = procedure(SrcAddr: PChar; Msg: PChar); stdcall;
function Init(ip: PChar; Port: Word; User: PChar; Pswd: PChar; Queue: PChar; QueueSize: Integer; Trace: TTraceProc; MO: TMOProc): Integer; stdcall;
C#如何调用?
[ DllImport(DLLNAME, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
public static extern int Init(string ip, ushort Port, string User, string Pswd, string Queue, int QueueSize,???, ???);
public delegate void MOProc (string srcAdd,string msg);[DllImport(DLLNAME, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.StdCall)]
public static extern int Init(string ip, ushort Port, string User, string Pswd, string Queue, int QueueSize,Traceproc tp,MOProc mop);
http://hi.baidu.com/shaic007/blog/item/04da3a54d1874c50574e0017.html