1
0

_macosx.py 523 B

123456789101112131415161718192021
  1. import ctypes
  2. # pylint: disable=import-error,no-name-in-module
  3. from ctypes.macholib.dyld import dyld_find
  4. class DLInfo: # pylint: disable=too-few-public-methods
  5. """
  6. >>> lib = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c'))
  7. >>> dlinfo = DLInfo(lib)
  8. >>> dlinfo.path
  9. '/usr/lib/libc.dylib'
  10. """
  11. def __init__(self, cdll: ctypes.CDLL):
  12. self._cdll = cdll
  13. @property
  14. def path(self) -> str:
  15. # pylint: disable=protected-access
  16. return dyld_find(self._cdll._name)