當前位置: 首頁>>代碼示例>>Python>>正文


Python _ctypes.LoadLibrary方法代碼示例

本文整理匯總了Python中_ctypes.LoadLibrary方法的典型用法代碼示例。如果您正苦於以下問題:Python _ctypes.LoadLibrary方法的具體用法?Python _ctypes.LoadLibrary怎麽用?Python _ctypes.LoadLibrary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在_ctypes的用法示例。


在下文中一共展示了_ctypes.LoadLibrary方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def __init__(self, name, mode=DEFAULT_MODE, handle=None,
                 use_errno=False,
                 use_last_error=False):
        self._name = name
        flags = self._func_flags_
        if use_errno:
            flags |= _FUNCFLAG_USE_ERRNO
        if use_last_error:
            flags |= _FUNCFLAG_USE_LASTERROR

        class _FuncPtr(_CFuncPtr):
            _flags_ = flags
            _restype_ = self._func_restype_
        self._FuncPtr = _FuncPtr

        if handle is None:
            self._handle = _dlopen(self._name, mode)
        else:
            self._handle = handle 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:21,代碼來源:__init__.py

示例2: test_load_library

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_library(self):
        self.assertIsNotNone(libc_name)
        if is_resource_enabled("printing"):
            print find_library("kernel32")
            print find_library("user32")

        if os.name == "nt":
            windll.kernel32.GetModuleHandleW
            windll["kernel32"].GetModuleHandleW
            windll.LoadLibrary("kernel32").GetModuleHandleW
            WinDLL("kernel32").GetModuleHandleW
        elif os.name == "ce":
            windll.coredll.GetModuleHandleW
            windll["coredll"].GetModuleHandleW
            windll.LoadLibrary("coredll").GetModuleHandleW
            WinDLL("coredll").GetModuleHandleW 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:18,代碼來源:test_loading.py

示例3: test_load_library

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_library(self):
            self.assertFalse(libc_name is None)
            if is_resource_enabled("printing"):
                print find_library("kernel32")
                print find_library("user32")

            if os.name == "nt":
                windll.kernel32.GetModuleHandleW
                windll["kernel32"].GetModuleHandleW
                windll.LoadLibrary("kernel32").GetModuleHandleW
                WinDLL("kernel32").GetModuleHandleW
            elif os.name == "ce":
                windll.coredll.GetModuleHandleW
                windll["coredll"].GetModuleHandleW
                windll.LoadLibrary("coredll").GetModuleHandleW
                WinDLL("coredll").GetModuleHandleW 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:18,代碼來源:test_loading.py

示例4: test_load_library

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_library(self):
        # CRT is no longer directly loadable. See issue23606 for the
        # discussion about alternative approaches.
        #self.assertIsNotNone(libc_name)
        if test.support.verbose:
            print(find_library("kernel32"))
            print(find_library("user32"))

        if os.name == "nt":
            windll.kernel32.GetModuleHandleW
            windll["kernel32"].GetModuleHandleW
            windll.LoadLibrary("kernel32").GetModuleHandleW
            WinDLL("kernel32").GetModuleHandleW
        elif os.name == "ce":
            windll.coredll.GetModuleHandleW
            windll["coredll"].GetModuleHandleW
            windll.LoadLibrary("coredll").GetModuleHandleW
            WinDLL("coredll").GetModuleHandleW 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:20,代碼來源:test_loading.py

示例5: test_load_library

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_library(self):
        self.assertIsNotNone(libc_name)
        if test.support.verbose:
            print(find_library("kernel32"))
            print(find_library("user32"))

        if os.name == "nt":
            windll.kernel32.GetModuleHandleW
            windll["kernel32"].GetModuleHandleW
            windll.LoadLibrary("kernel32").GetModuleHandleW
            WinDLL("kernel32").GetModuleHandleW
        elif os.name == "ce":
            windll.coredll.GetModuleHandleW
            windll["coredll"].GetModuleHandleW
            windll.LoadLibrary("coredll").GetModuleHandleW
            WinDLL("coredll").GetModuleHandleW 
開發者ID:IronLanguages,項目名稱:ironpython3,代碼行數:18,代碼來源:test_loading.py

示例6: test_load_library

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_library(self):
        # CRT is no longer directly loadable. See issue23606 for the
        # discussion about alternative approaches.
        #self.assertIsNotNone(libc_name)
        if test.support.verbose:
            print(find_library("kernel32"))
            print(find_library("user32"))

        if os.name == "nt":
            windll.kernel32.GetModuleHandleW
            windll["kernel32"].GetModuleHandleW
            windll.LoadLibrary("kernel32").GetModuleHandleW
            WinDLL("kernel32").GetModuleHandleW
            # embedded null character
            self.assertRaises(ValueError, windll.LoadLibrary, "kernel32\0")
        elif os.name == "ce":
            windll.coredll.GetModuleHandleW
            windll["coredll"].GetModuleHandleW
            windll.LoadLibrary("coredll").GetModuleHandleW
            WinDLL("coredll").GetModuleHandleW 
開發者ID:ShikyoKira,項目名稱:Project-New-Reign---Nemesis-Main,代碼行數:22,代碼來源:test_loading.py

示例7: test_load_version

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_version(self):
        cdll.LoadLibrary("libc.so.6")
        # linux uses version, libc 9 should not exist
        self.assertRaises(OSError, cdll.LoadLibrary, "libc.so.9")
        self.assertRaises(OSError, cdll.LoadLibrary, self.unknowndll) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:7,代碼來源:test_loading.py

示例8: test_find

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_find(self):
        for name in ("c", "m"):
            lib = find_library(name)
            if lib:
                cdll.LoadLibrary(lib)
                CDLL(lib) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:8,代碼來源:test_loading.py

示例9: test_1703286_A

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_1703286_A(self):
        from _ctypes import LoadLibrary, FreeLibrary
        # On winXP 64-bit, advapi32 loads at an address that does
        # NOT fit into a 32-bit integer.  FreeLibrary must be able
        # to accept this address.

        # These are tests for http://www.python.org/sf/1703286
        handle = LoadLibrary("advapi32")
        FreeLibrary(handle) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:11,代碼來源:test_loading.py

示例10: test_load_version

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_load_version(self):
            cdll.LoadLibrary("libc.so.6")
            # linux uses version, libc 9 should not exist
            self.assertRaises(OSError, cdll.LoadLibrary, "libc.so.9")
            self.assertRaises(OSError, cdll.LoadLibrary, self.unknowndll) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:7,代碼來源:test_loading.py

示例11: test_1703286_A

# 需要導入模塊: import _ctypes [as 別名]
# 或者: from _ctypes import LoadLibrary [as 別名]
def test_1703286_A(self):
            from _ctypes import LoadLibrary, FreeLibrary
            # On winXP 64-bit, advapi32 loads at an address that does
            # NOT fit into a 32-bit integer.  FreeLibrary must be able
            # to accept this address.

            # These are tests for http://www.python.org/sf/1703286
            handle = LoadLibrary("advapi32")
            FreeLibrary(handle) 
開發者ID:dxwu,項目名稱:BinderFilter,代碼行數:11,代碼來源:test_loading.py


注:本文中的_ctypes.LoadLibrary方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。