This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Malcolm Smith
Recipients Malcolm Smith, superbobry
Date 2020-02-10.22:25:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1581373502.12.0.476534653585.issue34592@roundup.psfhosted.org>
In-reply-to
Content
This isn't documented, but CDLL(None) is translated to dlopen(NULL), which "causes a search for a symbol in the main program, followed by all shared libraries loaded at program startup, and then all shared libraries loaded by dlopen() with the flag RTLD_GLOBAL" (https://linux.die.net/man/3/dlopen).

This is sometimes useful because it lets you look up a symbol in an already-loaded library without needing to give the library's name. For example:

>>> import ctypes
>>> dll = ctypes.CDLL(None)
>>> dll.printf
<_FuncPtr object at 0x7f3427d547c0>
>>> dll.PyObject_Str
<_FuncPtr object at 0x7f3427d54880>
History
Date User Action Args
2020-02-10 22:25:02Malcolm Smithsetrecipients: + Malcolm Smith, superbobry
2020-02-10 22:25:02Malcolm Smithsetmessageid: <1581373502.12.0.476534653585.issue34592@roundup.psfhosted.org>
2020-02-10 22:25:02Malcolm Smithlinkissue34592 messages
2020-02-10 22:25:02Malcolm Smithcreate