网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

对 PInvoke 函数的调用导致堆栈不对称问题

时间:2026-02-20 01:28:35

1、解决方法很简单,只要添加属性: CallingConvention=CallingConvention.Cdecl即可。

例如:[DllImport("TestApi.dll")]   internal extern static IntPtr TestApi(); 

添加属性CallingConvention=CallingConvention.Cdecl

改成[DllImport("TestApi.dll",CallingConvention=CallingConvention.Cdecl)]   internal extern static IntPtr TestApi(); 即可。

© 2026 智德知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com