本文整理汇总了Python中ctypes.RTLD_LOCAL属性的典型用法代码示例。如果您正苦于以下问题:Python ctypes.RTLD_LOCAL属性的具体用法?Python ctypes.RTLD_LOCAL怎么用?Python ctypes.RTLD_LOCAL使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类ctypes
的用法示例。
在下文中一共展示了ctypes.RTLD_LOCAL属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _load_lib
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import RTLD_LOCAL [as 别名]
def _load_lib():
"""Load library by searching possible path."""
lib_path = libinfo.find_lib_path()
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
# DMatrix functions
lib.MXGetLastError.restype = ctypes.c_char_p
return lib
# version number
示例2: _load_libzmq
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import RTLD_LOCAL [as 别名]
def _load_libzmq():
"""load bundled libzmq if there is one"""
import sys, ctypes, platform, os
dlopen = hasattr(sys, 'getdlopenflags') # unix-only
# RTLD flags are added to os in Python 3
# get values from os because ctypes values are WRONG on pypy
PYPY = platform.python_implementation().lower() == 'pypy'
if dlopen:
dlflags = sys.getdlopenflags()
# set RTLD_GLOBAL, unset RTLD_LOCAL
flags = ctypes.RTLD_GLOBAL | dlflags
# ctypes.RTLD_LOCAL is 0 on pypy, which is *wrong*
flags &= ~ getattr(os, 'RTLD_LOCAL', 4)
# pypy on darwin needs RTLD_LAZY for some reason
if PYPY and sys.platform == 'darwin':
flags |= getattr(os, 'RTLD_LAZY', 1)
flags &= ~ getattr(os, 'RTLD_NOW', 2)
sys.setdlopenflags(flags)
try:
from . import libzmq
except ImportError:
pass
else:
# store libzmq as zmq._libzmq for backward-compat
globals()['_libzmq'] = libzmq
if PYPY:
# some versions of pypy (5.3 < ? < 5.8) needs explicit CDLL load for some reason,
# otherwise symbols won't be globally available
# do this unconditionally because it should be harmless (?)
ctypes.CDLL(libzmq.__file__, ctypes.RTLD_GLOBAL)
finally:
if dlopen:
sys.setdlopenflags(dlflags)
示例3: __init__
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import RTLD_LOCAL [as 别名]
def __init__(self):
self.RTLD_LAZY = 0 # not supported anyway by ctypes
self.RTLD_NOW = 0
self.RTLD_GLOBAL = ctypes.RTLD_GLOBAL
self.RTLD_LOCAL = ctypes.RTLD_LOCAL
示例4: _load_lib
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import RTLD_LOCAL [as 别名]
def _load_lib():
"""Load libary by searching possible path."""
lib_path = libinfo.find_lib_path()
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
# DMatrix functions
lib.NNGetLastError.restype = ctypes.c_char_p
return lib
# version number
示例5: _load_lib
# 需要导入模块: import ctypes [as 别名]
# 或者: from ctypes import RTLD_LOCAL [as 别名]
def _load_lib():
"""Load library by searching possible path."""
lib_path = libinfo.find_lib_path()
lib = ctypes.CDLL(lib_path[0], ctypes.RTLD_LOCAL)
# DMatrix functions
lib.MXGetLastError.restype = ctypes.c_char_p
return lib
# version number