c#调用非托管DLL出错的问题
原形
int CFCA_VerifySignedDataDetached(char *signature, long signatureLength, char* originalData, int *originalDataLength, char *certificate, long *certificateLength, HCFCAToolkit toolkitHandle);
signature 输入
signatureLength 输入
originalData 输入
originalDataLength 输入
certificate 输出
certificateLength 输出
toolkitHandle 输入
转换成
[DllImport( "CFCAToolkit.dll ", EntryPoint = "CFCA_VerifySignedDataDetached ", SetLastError = true,
CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern int CFCA_VerifySignedDataDetached(string signature, long signatureLength, string originalData, ref int originalDataLength, char[] certificate, ref long certificateLength, IntPtr toolkitHandle);
调用报AccessViolationException异常,似乎是certificate这个参数传递造成的,请高手指点!
------解决方案--------------------参数 char[] certificate 与原型中char *certificate不一致,你最好将char[] certificate
换成string certificate试一下
------解决方案--------------------使用unsafe吧
------解决方案-------------------- 参数 char[] certificate 与原型中char *certificate不一致,你最好将char[] certificate
换成string certificate试一下
------解决方案--------------------帮LZ顶
------解决方案--------------------char[] certificate换成string certificate