
LoadLibrary failed with a return code of 126
It's likely that your DLL depends on another DLL that is not present. Make
sure all DLLs are present in a place the loader will look (check the SDK
LoadLibrary() help to see the search the loader will do).
To get a list of DLLs your DLL is dependent on, use "dumpbin /imports
snmp-mibii.dll" from your desktop machine. You will get a listing of all
DLLs that your DLL calls directly. Note that this is only a first-level
dependency check. Those DLLs can in turn have other dependencies, of
course.
Other possibilities:
the file doesn't actually exist (spelling?)
you don't have UNICODE defined at build time (unlikely - you'd have to
specifically remove it as it is the default setting)
the file is in use with no sharing (though you'd probably get a
different error code in this case)
HTH
--
Michael Salamone
Entrek Software, Inc.
http://www.entrek.com
Quote:
> I am trying load a DLL in the \Windows directory using the LoadLibrary
> function. I tried different ways to specify the library name with or
> without the path. It always returns NULL. The error code returned by
> GetLastError() is 126 that means the specified module could not be
> found, but the DLL exists in the \Windows directory.
> The following are the statements I tried:
> HINSTANCE hDLL = LoadLibrary(TEXT("\\Windows\\snmp-mibii.dll"));
> HINSTANCE hDLL = LoadLibrary(TEXT("snmp-mibii.dll"));
> Could anybody give me some hint what may be wrong? Thanks.
> Ruth Hsu
> Intermec Technologies Corporation