首页 新闻 会员 周边 捐助

C#调用delphi 编写的dll 出错

0
悬赏园豆:50 [已关闭问题] 关闭于 2007-11-27 15:14
<P>delphi中函数定义如下:<BR>Funcation WIS_VerifyTemplate(hInit:Thandle; RawTemplate:PChar; EnrlTemplate:PChar; security:LongInt; score:Pointer):LongInt;</P> <P>c#中调用&nbsp;<BR>[DllImport("Wis_Api.dll", EntryPoint = "WIS_VerifyTemplate", <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CallingConvention=CallingConvention.StdCall)]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public unsafe static extern int VerifyFingerprint(long hInit, string source, string des, int secruity, object score);<BR><BR>static void Main(string[] args)<BR>{<BR>&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; object score = new object();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long hInit = 1;</P> <P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int val = VerifyFingerprint(hInit, "TEST", "test", 2, score);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine("score:{0},return value:{1}", score, val.ToString());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception ex)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine(ex.Message);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>}<BR><BR>错误信息:Attempted to read or write protected memory. This is often an indication that other memory is corrupt.<BR>请各位高手帮小弟看看错误原因为何啊?<BR></P>
小树爸爸的主页 小树爸爸 | 菜鸟二级 | 园豆:210
提问于:2007-11-27 13:40
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册