Malcolm Smith <malcolm.sm...@gmail.com> added the comment:

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>

----------
nosy: +Malcolm Smith

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue34592>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to