Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b6f2fc9

Browse files
authored
bpo-25655: Improve Win DLL loading failures doc (GH-22372)
Add documentation to help diagnose CDLL dependent DLL loading errors on windows for OSError with message: "[WinError 126] The specified module could not be found" This error is otherwise difficult to diagnose.
1 parent 283f9a2 commit b6f2fc9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Doc/library/ctypes.rst

+15
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,21 @@ way is to instantiate one of the following classes:
13261326
libraries use the standard C calling convention, and are assumed to return
13271327
:c:type:`int`.
13281328

1329+
On Windows creating a :class:`CDLL` instance may fail even if the DLL name
1330+
exists. When a dependent DLL of the loaded DLL is not found, a
1331+
:exc:`OSError` error is raised with the message *"[WinError 126] The
1332+
specified module could not be found".* This error message does not contain
1333+
the name of the missing DLL because the Windows API does not return this
1334+
information making this error hard to diagnose. To resolve this error and
1335+
determine which DLL is not found, you need to find the list of dependent
1336+
DLLs and determine which one is not found using Windows debugging and
1337+
tracing tools.
1338+
1339+
.. seealso::
1340+
1341+
`Microsoft DUMPBIN tool <https://docs.microsoft.com/cpp/build/reference/dependents>`_
1342+
-- A tool to find DLL dependents.
1343+
13291344

13301345
.. class:: OleDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=0)
13311346

0 commit comments

Comments
 (0)