Upon running the following C# application which references an unmanaged DLL (written in C), I get an DllNotFound exception with the following information:
Additional information: Unable to load DLL 'C:\Windows\System32\myLib.dll': The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)
What I've tried:
This is baffling as there appear to be so few dependencies required to load a DLL.
Don't copy your DLLs to the system folder. That belongs to the system and you should not modify it. Remove those DLLs from any system folders they have been placed in.
Instead put your DLLs in the same directory as the executable. After that the other step that is needed is to make sure that any dependencies, typically the VC runtime, are available. Depending on exactly how you want to deploy this will likely involve installing the VC redistributable package on any target machine.
An older version of a dependency (a Jungo DLL in this case), which did not export the same set of functions as the newer version, had been installed to the machine with the error. Copying the newer version over solved the problem.
So, while the dependent file was present on both machines, the necessary set of exported functions were not. C# specified a "procedure could not be found" error on DLL A, when technically, it was on a dependency of a dependency.
Dependency walker proved useful in identifying what the dependencies were in the first place and indicating that there was a missing import in one of them.
User contributions licensed under CC BY-SA 3.0