Exemplo n.º 1
0
def get_library():
    try:
        library = ctypes_library.NidmmCtypesLibrary(get_library_name(),
                                                    get_library_type())
    except OSError:
        raise errors.DriverNotInstalledError()

    return library
Exemplo n.º 2
0
    def __init__(self):
        if LibrarySingleton.instance is None:
            try:
                LibrarySingleton.instance = ctypes_library.NidmmCtypesLibrary(
                    get_library_name(), get_library_type())
            except OSError:
                raise errors.DriverNotInstalledError()

        self._library = LibrarySingleton.instance
Exemplo n.º 3
0
def get():
    '''get

    Returns the library.Library singleton for nidmm.
    '''
    global _instance
    global _instance_lock

    with _instance_lock:
        if _instance is None:
            try:
                library_type = _get_library_type()
                if library_type == 'windll':
                    ctypes_library = ctypes.WinDLL(_get_library_name())
                else:
                    assert library_type == 'cdll'
                    ctypes_library = ctypes.CDLL(_get_library_name())
            except OSError:
                raise errors.DriverNotInstalledError()
            _instance = _library.Library(ctypes_library)
        return _instance