Having said that; in my case running dumpbin /DEPENDENTS as suggested by @anthony-hayward, and copying over 32-bit versions of the DLLs listed there into my working directory solved this problem for me.
"Unable to load DLL 'xxx.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)" means the file CAN be found BUT it's not able to load it. Try to copy the DLL file to the root folder of your application, some DLL libraries need to be available in the root folder of the application in order for it to work. Or check if there are any other depending DLL files required by it.
All the code which was making the p/invoke was present in ClassLibrary1.dll. So before debugging the application from visual studio I simply copied the C++ unmanaged assembly (myUnmanagedFunctions.dll) into the \bin\debug\ directory of ClassLibrary1 project so that it can be loaded at run-time by the CLR.
error for hours. Later on I realized that all such unmanaged assemblies which are to be loaded need to be copied into the \bin\debug directory of the start-up project ConsoleApplication1 which is usually a win form, console or web application.
So please be cautious the Current Directory in the accepted answer actually means Current Directory of main executable from where you application process is starting. Looks like an obvious thing but might not be so at times.
Also, as clarified in other answers - your DLL will need to reside in the correct folder on your machine depending on whether the DLL is 32bit or 64bit. (Also make sure any dependencies of the DLL are in the same folder as the DLL)
If the DLL and the .NET projects are in the same solution and you want to compile and run both every time, you can right click the properties of the .NET project, Build events, then add something like the following to Post-build event command line:
In summary, several Redistributable library versions can be installed in your box but only one of them should satisfy your App, and it might not be the default, so you need to tell the system the version your library needs, that's why the manifest.
Long Answer:I also used Dependency Walker, which identified several missing dependency modules. Immediately, I thought that it must have been a botched driver installation. I didn't want to check and restore each missing file.
The fact that I was unable to find the uninstaller under Programs and Features of the Control Panel is another indicator of bad installation. I had to manually delete a couple of *.dll in \system32 and registry keys to allow for driver re-installation.
I had a similar problem importing an external library. This library contains the dllImport attribute in a class referenced. In my case, the problem is thrown because the DLL to be imported has another dependencies that were not located in the folder where my main executable is running. After adding the other reference to the folder, the executables run successfully.
It has nothing to do with dependencies if you checked all dependencies and you know you got them all, it has nothing to do with the file being in the wrong directory either or incorrect ARGUMENTS passed to dll, the DLL Fails to load using LoadLibrary itself.. you could check the address returned from LoadLibrary is always 0x0000000 (not loaded).
I couldn't figure this error out either it worked fine on Windows 7, but on Windows 10 it doesn't work. I fixed the problem though it had nothing to do with missing dependencies or Runtime redistributable packs.
Something with the file being unpacked and compiled on old Windows XP operating system created a bad PE Header or Bad file format or something, but packing it with UPX did the trick works fine now and the DLL got 3x smaller haha.
Download hcnetsdk.dll below to solve your dll problem. We currently have 1 version available for this file.
If you have other versions of this file, please contribute to the community by uploading that dll file.
Errors related to hcnetsdk.dll can arise for a few different different reasons. For instance, a faulty application, hcnetsdk.dll has been deleted or misplaced, corrupted by malicious software present on your PC or a damaged Windows registry.
In the vast majority of cases, the solution is to properly reinstall hcnetsdk.dll on your PC, to the Windows system folder. Alternatively, some programs, notably PC games, require that the DLL file is placed in the game/application installation folder.
Do you have information that we do not?
Did our advice help or did we miss something?
Our Forum is where you can get help from both qualified tech specialists and the community at large. Sign up, post your questions, and get updates straight to your inbox.
To quickly resolve your problem, we recommend download and use hcnetsdk.dll Fix Tool. If you have technical experience and you want to install a DLL file manually, please select your version of Windows and download hcnetsdk.dll, after that copy it to the appropriate place using the instruction below, it will fix dll errors.
Some applications or games may need this file to work properly. If hcnetsdk.dll is missing, whenever you start the application/game you may experience various kinds of errors. To fix those errors, please read the Recommended Solution below.
If a program or game requires hcnetsdk.dll, then Windows will check for the .dll file before launching the program. If any issue is detected, it will display an error and the program won't launch. A few examples of the errors are:
These errors are displayed when this DLL file is missing from your PC, has issues, or that it is corrupted. In such cases, the solution is to reinstall the DLL file on your computer or place it in the program or game that requires it.
There are two ways in which you can install this DLL file on your computer. You can either copy the file to the installation folder of the application that requires the DLL or register it using Microsoft REGSVR. Here are the instructions for both the methods:
First of all, it is worth understanding why a hcnetsdk.dll file is missing and why hcnetsdk.dll errors occur. It is widespread for users to encounter situations where software does not work due to flaws in .dll files.
DLLs (Dynamic-Link Libraries) are shared libraries in Microsoft Windows, implemented by Microsoft Corporation. DLL files are just as important as files with an EXE extension, and DLL archives are simply impossible to implement without tools with .exe extension.:
As practice shows, the error is caused by an unintentionally deleted Hcnetsdk.dll file, which forces applications to crash. Malicious programs and infections by them cause Hcnetsdk.dll with the rest of the system files to get corrupted.
You can fix Hcnetsdk.dll automatically using the error fixing tool! This kind of device is designed to repair corrupted/deleted files in Windows folders. Install it, run it, and the program will automatically fix your Hcnetsdk.dll problems.
Hcnetsdk.dll error can also appear because of Microsoft Visual C++ Redistributable Package. You should check for updates and reinstall the software. Use Windows Updates search for this action. When you find the Microsoft Visual C ++ Redistributable Package, you can update it or remove the outdated version and reinstall the program.
System File Checker (SFC) is a utility in Windows that allows users to scan for corruptions in Windows system files and restore them. This guide describes how to run the System File Checker tool (SFC.exe) to scan your system files and to repair missing or corrupted system files (including .DLL files). If a Windows Resource Protection (WRP) file is missing or corrupted, Windows might not behave as expected. For example, some Windows functions might not work, or Windows might crash. The "sfc scannow" option is one of several specific switches available with the sfc command, the Command Prompt command used to run System File Checker. To run it, first open Command Prompt first by typing "command prompt" in Search, right-click on "Command Prompt", and then select "Run as administrator" from the drop-down menu to run Command Prompt with administrator privileges. You must run an elevated Command Prompt to be able to perform a SFC scan.
Registry Cleaner is a powerful utility that can clean unnecessary files, fix registry problems, find out the causes of slow PC operation and eliminate them. The program is ideal for working on a PC. People with administrator rights can quickly scan and then clean a user's registry.
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.
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