How to solve HRESULT: 0x8007007E problem
Symptoms:
- you use Visual Studio 2010
2. you create a Visual C# / Windows Application
3. you add reference to a .NET assembly like C:\Program Files\Nuance\OPCaptureSDK19\Bin64\CAPI_PInvoke.dll
4. in your project you call a function from the referenced .NET assmebly, e.g. RecAPI.kRecInit()
5. you compile the project, it compiles without an error, and you try to run it
At this point you get an error:
System.DllNotFoundException was unhandled
Message="Unable to load DLL 'KernelAPI.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
Cause:
This actually means that your application has found KernelAPI.dll, otherwise the error would be 'cannot find...'.
But even though your application is able for find KerneAPI.dll, it is not able to load it, because there are dependent DLLs, which your application cannot find.
Resolution:
The solution of this problem is not specific to our SDK. It is documented in Windows web pages what you can do in such a case.
Here are some examples for your convenience:
- you can place your application exe in the same folder with the Engine binaries, or
- you can add the Engine binaries folder to the PATH environment variable of your system,
- if you are using .NET then
- you can create a proper .config file for your application referencing the Engine binaries
- you can register CAPI_PInvoke.dll in GAC
Note:
- there are other methods to eliminate this problem, all in all the main purpose is that your application should be able to find not only the KernelAPI.dll, but all other ENGine binaries as well.
- in the above example Visual Studio 2010 and OPCaptureSDK19 are mentioned, but they can be replaced by any other version of VS and OP SDK