P\Invoke 签名错误
当我尝试使用带有以下函数的 p\invoke 的函数时出现错误
声明
extern "C" __declspec(dllexport) HRESULT Get_GetLastHR(HANDLE);
定义
HRESULT Get_GetLastHR(HANDLE _xmlParser ){
return ((FCEXMLParser*)_xmlParser)->GetLastHR();
}
VB.Net 中使用的 p\Invoke 签名
Public Shared Function Get_GetLastHR(ByVal param0 As System.IntPtr) As Integer
*错误*
*对 PInvoke 函数“FeeCalculator!FeeCalculator.FeeEngine.FeeEngineMethods::Get_GetLastHR”的调用有堆栈不平衡。这可能是因为托管 PInvoke 签名与非托管目标签名不匹配。检查PInvoke签名的调用约定和参数是否与目标非托管签名匹配。*
使用的签名是否有问题?
I am getting error when I was trying to use function using p\invoke with following function
declaration
extern "C" __declspec(dllexport) HRESULT Get_GetLastHR(HANDLE);
definition
HRESULT Get_GetLastHR(HANDLE _xmlParser ){
return ((FCEXMLParser*)_xmlParser)->GetLastHR();
}
p\Invoke signature used in VB.Net
Public Shared Function Get_GetLastHR(ByVal param0 As System.IntPtr) As Integer
*ERROR*
*A call to PInvoke function 'FeeCalculator!FeeCalculator.FeeEngine.FeeEngineMethods::Get_GetLastHR' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.*
Is there any problem with the signature used?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论