当前位置: 首页>>代码示例>>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;未经允许,请勿转载。