def _load_or_error(name):
path = util.find_library(name)
if path is not None:
return CDLL(path)
# On iOS (and probably also watchOS and tvOS), ctypes.util.find_library doesn't work and always returns None.
# This is because the sandbox hides all system libraries from the filesystem and pretends they don't exist.
# However they can still be loaded if the path is known, so we try to load the library from a few known locations.
for loc in _lib_path:
try:
return CDLL(os.path.join(loc, "lib" + name + ".dylib"))
except OSError:
pass
for loc in _framework_path:
try:
return CDLL(os.path.join(loc, name + ".framework", name))
except OSError:
pass
raise ValueError("Library {!r} not found".format(name))
评论列表
文章目录