Re: LibraryLoader loads wrong DLL
Thomas Heller <[email protected]> Wed, 14 Mar 2012 10:07:48 +0100
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
Am 14.03.2012 09:31, schrieb Thor Andreas Tangen:
> Hi
>
> I have a DLL, lets call it interface.dll, which wraps a C++ API. This
> C++ API depends on another API located in console.dll. This
> console.dll is shipped with the C++ API and is specific to this API,
> i.e. the people who has made the API also made the console.dll. Both
> the console.dll and the C++ API DLL is located in the same folder as
> my interface.dll. But when using
> ctypes.cdll.LoadLibrary("interface.dll") the loading fails. The error
> reported is that a ceratin function cannot be found in the
> console.dll. Using DependencyWalker to profile the loading of the
> interface.dll I discovered that the LoadLibrary folder tries to load
> console.dll found in C:\Windows\system32 instead of the console.dll
> found in the same folder as interface.dll.
>
> Is this the wanted behaviour? Is there a way I can "help" the
> LibraryLoader to find the right DLL?
The strategy that LoadLibrary uses to find a dll is explained in the
MSDN docs:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175%28v=vs.85%29.aspx
Probably you should call LoadLibrary("console.dll"), maybe with the full
path, before LoadLibrary("interface.dll").
Thomas
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/