.NET 和 .NET 之间的堆栈调用约定WinCE 6.0上的C
我正在将用 C 编写的 DLL 从 WinCE 5.0 移植到 ARM 目标上的 WinCE 6.0。该 DLL 由 .NET 软件调用。在WinCE5.0上,一切运行正常。在 WinCE6 上,我遇到以下问题:
在我的 DLL 的 InitInstance() 上,我可以毫无问题地调用任何内容(例如 MessageBox())或使用递归性。
过了这一点,.NET 代码就会调用 DLL。然后它失败了:甚至 .NET 代码传递的参数也看起来很奇怪。我可以调用 MessageBox() 一次,但无法调用一个先调用 MessageBox() 再调用自身的函数:递归性已被破坏。
.NET 代码使用堆栈的方式似乎与我的 C 代码不同。
我对 Windows 世界非常陌生,而且为我提供 .NET 应用程序的公司还不明白为什么会出现这样的失败。
欢迎任何指示/提示/建议!
谢谢!
I'm porting a DLL written in C from WinCE 5.0 to WinCE 6.0 on an ARM target. This DLL is called by a .NET software. On WinCE5.0, everything runs fine. On WinCE6, I have the following problem:
on InitInstance() of my DLL, I can call anything without problem (for example MessageBox()) or uses recursivity.
Passed that point, the DLL is called by .NET code. And then it fails: even the arguments passed by .NET code seem weird. I can call MessageBox() once, but I can't call a function that calls MessageBox() and then that calls itself: recursivity is broken.
It seems that the .NET code uses the stack in a different way than my C code.
I'm very unfamillar with the Windows world and the company that gives me the .NET application does not understand yet why there is such a failure.
Any pointer/hint/advice welcome!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来调用约定在某个时刻发生了变化,在 EV4/WinCE5 上编译并由某些 .NET 代码调用的 DLL 与为 VS2008/WinCE6 编译的相同 DLL 之间。现在我的 DLL 接收到一个指向宽字符而不是对象的指针...条件编译解决了我的问题,而我希望从一些官方文档中获得“真实”的解释。不管怎样,现在事情已经解决了。
Well it appears that the calling convention changed at some point, between a DLL compiled on EV4/WinCE5 and called by some .NET code, and the same DLL compiled for VS2008/WinCE6. Now my DLL receives a pointer to wide chars instead of an object... Conditional compilation solved my problem while I would have liked to get a 'real' explanation from some official doc. Anyway the matter is settled now.