Message 228538 - Python tracker (original) (raw)
If you want cached libs without polluting ctypes.cdll or ctypes.windll, just create your own instance such as windll = ctypes.LibraryLoader(ctypes.WinDLL).
This one looks like the next best thing to the current state of affairs, requiring minimal change to existing code.
`cast' appears to be the "right way" when saving individual _FuncPtr's in a local namespace but it's far from being obvious.
If going this way, a prominent warning in https://docs.python.org/2.7/library/ctypes.html?highlight=ctypes#loading-dynamic-link-libraries with the way to go would probably suffice.