(name)
Load and return the C library with the given name.

    If the library could not be found, a :class:`ValueError` is raised.

    Internally, this function uses :func:`ctypes.util.find_library` to search for the library in the system-standard
    locations. If the library cannot be found this way, it is attempted to load the library from certain hardcoded
    locations, as a fallback for systems where ``find_library`` does not work (such as iOS).
Load and return the C library with the given name.
Load and return the C library with the given name .
def load_library(name):
    """Load and return the C library with the given name.

    If the library could not be found, a :class:`ValueError` is raised.

    Internally, this function uses :func:`ctypes.util.find_library` to search for the library in the system-standard
    locations. If the library cannot be found this way, it is attempted to load the library from certain hardcoded
    locations, as a fallback for systems where ``find_library`` does not work (such as iOS).
    """

    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))
def load_library ( 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 ) )