Skip to content

Commit 01c97fb

Browse files
committed
gh-88130: Document macOS library search limits for ctypes.CDLL
1 parent 7271803 commit 01c97fb

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎Doc/library/ctypes.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,14 @@ way is to instantiate :py:class:`CDLL` or one of its subclasses:
15841584
they are not added automatically.
15851585
See :ref:`ctypes-finding-shared-libraries` for more information.
15861586

1587+
On macOS, a *name* that is not an absolute path may only be searched
1588+
for in system locations such as :file:`/usr/lib`. Libraries and
1589+
frameworks in folders like :file:`/usr/local/lib`, :file:`~/lib` or
1590+
:file:`~/Library/Frameworks` are then not found, so pass the full path.
1591+
Setting :envvar:`!DYLD_LIBRARY_PATH` or :envvar:`!DYLD_FRAMEWORK_PATH`
1592+
before starting Python adds search locations, but macOS ignores these
1593+
variables for some executables.
1594+
15871595
On non-Windows systems, *name* can be ``None``. In this case,
15881596
:c:func:`!dlopen` is called with ``NULL``, which opens the main program
15891597
as a "library".
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Document that :class:`ctypes.CDLL` on macOS may not find libraries in
2+
:file:`/usr/local/lib` or user folders unless given a full path.

0 commit comments

Comments
 (0)