Reputation: 2464
I am using "LoadLibraryA()" for loading my dll. Here is the code for loading dll I used -
std::string m_sDllRegPath = "F:\\Releases\\SampleApp\\MyDll.dll";
m_hDll = LoadLibraryA(m_sDllRegPath.c_str());
But the problem is that value of m_hDll is always null, that it means it has failed to load the dll. A call to GetLastError
returns 126.
But the same code works fine for 32 bit system. I don't know where is the problem.
Upvotes: 0
Views: 305
Reputation: 612784
Error code 126 is ERROR_MOD_NOT_FOUND
:
The specified module could not be found.
If there really is a DLL with the file name that you provide, then the explanation is that one of the DLL's dependencies is missing. Almost invariably this is because the C++ runtime that is required by the DLL is not present. Check the requirements of the DLL, and make sure that all required dependencies are correctly installed.
Upvotes: 3