简体   繁体   中英

unable to load 64 bit dll

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM