How do I solve the .NET CF exception “Can't find PInvoke DLL”?

若如初见. 提交于 2019-12-03 16:37:30

Maybe this seems like an obvious thing to check, but are you compiling the native DLL for the correct CPU architecture? IIRC, Windows Mobile runs on multiple CPU architectures.

I have the same problem, but this time there is no obvious difference in the platforms involved. Why is it something that is supposed to be 'normal' is so badly documented, so difficult and worst of all so 'flaky'. Are there ANY tools that allow me to go onto my PPC emulator, and stop by step check (a) that the dll is where CLR expects it (I have put it both in the same directory, and the windows directory on the emulator - I can see it is there usign the emulators file explorer), (b) that CLR can load it (has enough memory etc), (c) that CLR can then find what functions are present (useful if I can get beyond the stupid 'can't find the dll' error)

I'd love to force Gates or indeed any of the 'windows mobile' team to use the crap they create.

The exception you listed and the pinvoke signature you put in the question have different names: MyDll.dll and ThreadBenchLib.dll respectively. Was that a typo or the problem?

If it's not the problem try opening the DLL in depends. It's possible the DLL load is failing because of an unmet dependency.

user2321654

I am having the same problem. I used the Depends.exe to look for WinCE dll dependencies, and It depends of debug dll. (MSVCR90D.dll) To solve the problem I compiled a release version, and confirm the dependencies, after that it works fine.

I hope to help

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!