DLLImport failing to load DLL
I have code to call a DLL that is written in C. This code works fine on developer machine where we have Windows7. But it fails on Kiosk where we have Windows Embedded Standard OS with following exception :"Unable to load DLL 'xxx.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)".
My DLL is in my working directory just as it was before. My project setup has not changed and the working directory is specified correctly. I tried setting the "DllImport" path with functions exported from Kernel.DLL, but it could not help. What could have changed to cause this error?
Load the DLL with ome tool like DependencyWalkier http://www.dependencywalker.com/ and check what external modules that DLL requires. It might have happened that you have something on your W7 that is not present at Kiosk machine. If I recall correctly, if .Net does not find all the dependencies, it will raise the very same exception.
That tool will allow you to see what native modules are referred by the DLL. If you manage to run that tool on the Kiosk, it will report you all the missing dependencies. If any - you have the reason. If none - well.. then the fun begins again:)
Btw. anything interesting in the stacktrace? Btw2. Have you tried enabling fusionlog? hm.. nah.. it is native DLL, so the Depends should find the cause. I bet it's the runtime version. AAAh right --- is that DLL completely yours or not? if yours, was that native DLL build with DEBUG or RELEASE mode? If debug, then recompile in Release. That's quite a common pitfall.
链接地址: http://www.djcxy.com/p/44446.html下一篇: DLLImport无法加载DLL