python类RTLD_GLOBAL的实例源码

__init__.py 文件源码 项目:gil_load 作者: chrisjbillington 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def _load_preload_lib():
    """profiling won't work if the library isn't preloaded using LD_PRELOAD,
    but we ensure it's loaded anyway so that we can import the cython
    extension and call its functions still - otherwise it won't import since
    it has not been linked to the preload library."""
    import os
    import ctypes
    from distutils.sysconfig import get_config_var
    this_dir = os.path.dirname(os.path.realpath(__file__))
    so_name = os.path.join(this_dir, 'preload')
    ext_suffix = get_config_var('EXT_SUFFIX')
    if ext_suffix is not None:
        so_name += ext_suffix
    else:
        so_name += '.so'
    import sys
    ctypes.CDLL(so_name, ctypes.RTLD_GLOBAL) 
    return so_name
SslPatch.py 文件源码 项目:zeronet-debian 作者: bashrc 项目源码 文件源码 阅读 57 收藏 0 点赞 0 评论 0
def openLibrary():
    import ctypes
    import ctypes.util
    try:
        if sys.platform.startswith("win"):
            dll_path = "src/lib/opensslVerify/libeay32.dll"
        elif sys.platform == "cygwin":
            dll_path = "/bin/cygcrypto-1.0.0.dll"
        else:
            dll_path = "/usr/local/ssl/lib/libcrypto.so"
        ssl = ctypes.CDLL(dll_path, ctypes.RTLD_GLOBAL)
        assert ssl
    except:
        dll_path = ctypes.util.find_library('ssl') or ctypes.util.find_library('crypto') or ctypes.util.find_library('libcrypto')
        ssl = ctypes.CDLL(dll_path or 'libeay32', ctypes.RTLD_GLOBAL)
    return ssl
backend_ctypes.py 文件源码 项目:noc-orchestrator 作者: DirceuSilvaLabs 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:SwiftKitten 作者: johncsnyder 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:aws-cfn-plex 作者: lordmuffin 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:git_intgrtn_aws_s3 作者: droidlabour 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:Intranet-Penetration 作者: yuxiaokui 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:Intranet-Penetration 作者: yuxiaokui 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:MKFQ 作者: maojingios 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:MKFQ 作者: maojingios 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
solvers.py 文件源码 项目:MatchingMarkets.py 作者: QuantEcon 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def COINMP_DLL_load_dll(path):
    """
    function that loads the DLL useful for debugging installation problems
    """
    import ctypes
    if os.name == 'nt':
        lib = ctypes.windll.LoadLibrary(str(path[-1]))
    else:
        #linux hack to get working
        mode = ctypes.RTLD_GLOBAL
        for libpath in path[:-1]:
            #RTLD_LAZY = 0x00001
            ctypes.CDLL(libpath, mode = mode)
        lib = ctypes.CDLL(path[-1], mode = mode)
    return lib
backend_ctypes.py 文件源码 项目:bawk 作者: jttwnsnd 项目源码 文件源码 阅读 75 收藏 0 点赞 0 评论 0
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
_base.py 文件源码 项目:Aurora 作者: upul 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def _load_lib():
    """Load libary in build/lib."""
    lib_root = Path(__file__).parents[2]
    lib_path = os.path.join(lib_root, 'cuda/build/lib/')
    path_to_so_file = os.path.join(lib_path, "libc_runtime_api.so")
    lib = ctypes.CDLL(path_to_so_file, ctypes.RTLD_GLOBAL)
    return lib


# global library instance
backend_ctypes.py 文件源码 项目:aws-lambda-python-codecommit-s3-deliver 作者: 0xlen 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:OneClickDTU 作者: satwikkansal 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:xxNet 作者: drzorm 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:xxNet 作者: drzorm 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
compilation.py 文件源码 项目:fython 作者: nicolasessisbreton 项目源码 文件源码 阅读 34 收藏 0 点赞 0 评论 0
def use_mkl():
    set_compiler(
        cmd = 'ifort',
        prefix = '',
        infix = '_mp_',
        suffix = '_',
        debug = """
            -g 
            -traceback
            -gen-interfaces 
            -warn all
            -check all
            -fpe0
            -ftrapuv
            -I/opt/intel/mkl/include
        """,
        release = """
            -fast
            -I/opt/intel/mkl/include
        """,
        link = """
            -L/opt/intel/mkl/lib/intel64 
            -lmkl_intel_lp64 
            -lmkl_core
            -lmkl_sequential 
            -lpthread 
            -lm
        """,
        error_regex = '(error #|ld:)',

        warning_regex = '(warning #|remark #)',
    )


    # needed to load mkl
    # see: https://answers.launchpad.net/dolfin/+question/205219
    import ctypes
    ctypes.CDLL('libmkl_rt.so', ctypes.RTLD_GLOBAL)
backend_ctypes.py 文件源码 项目:gardenbot 作者: GoestaO 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:slack_scholar 作者: xLeitix 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:ropi 作者: ThumbGen 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:RemoteTree 作者: deNULL 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:quickstart-git2s3 作者: aws-quickstart 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:quickstart-git2s3 作者: aws-quickstart 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:Docker-XX-Net 作者: kuanghy 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:Docker-XX-Net 作者: kuanghy 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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
backend_ctypes.py 文件源码 项目:PyQYT 作者: collinsctk 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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
gfapi.py 文件源码 项目:glustertool 作者: gluster 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def _lazy_init_libgfapi():
    """
    Loads ctypes library only if not loaded already
    """
    global _api
    if not _api:
        _api = ctypes.CDLL(find_library("gfapi"), ctypes.RTLD_GLOBAL)
clib.py 文件源码 项目:cwrap 作者: Statoil 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def load( lib, so_version = None, path = None, so_ext = None):
    """Thin wrapper around the ctypes.CDLL function for loading shared
    library.

    If the path argument is non Null the function will first try to
    load with full path. If that fails it wil also try to load without
    a path component, invoking normal dlopen() semantics.
    """

    dll = None
    lib_files = [ lib_name( lib, path = None, so_version = so_version ),
                  lib_name( lib, path = None, so_version = so_version, so_ext = so_ext ),
                  lib_name( lib, path = path, so_version = so_version ),
                  lib_name( lib, path = path, so_version = so_version, so_ext = so_ext )
                ]

    for lib_file in lib_files:
        try:
            dll = ctypes.CDLL(lib_file , ctypes.RTLD_GLOBAL)
            return dll
        except Exception as exc:
            error = exc

    error_msg = "\nFailed to load shared library:%s\n\ndlopen() error: %s\n" % (lib , error)

    LD_LIBRARY_PATH = os.getenv("LD_LIBRARY_PATH")
    if not LD_LIBRARY_PATH:
        LD_LIBRARY_PATH = ""

    error_msg += """
The runtime linker has searched through the default location of shared
libraries, and also the locations mentioned in your LD_LIBRARY_PATH
variable. Your current LD_LIBRARY_PATH setting is:

   LD_LIBRARY_PATH: %s

You might need to update this variable?
""" % LD_LIBRARY_PATH
    raise ImportError(error_msg)
compilation.py 文件源码 项目:fython 作者: nicolasessisbreton 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def use_mkl_blas_lapack():
    set_compiler(
        cmd = 'ifort',
        prefix = '',
        infix = '_mp_',
        suffix = '_',
        debug = """
            -g 
            -traceback
            -gen-interfaces 
            -warn all
            -check all
            -fpe0
            -ftrapuv
            -qopenmp
            -I/opt/intel/mkl/include/intel64/lp64
            -I/opt/intel/mkl/include
        """,
        release = """
            -fast
            -qopenmp
            -I/opt/intel/mkl/include/intel64/lp64
            -I/opt/intel/mkl/include
        """,
        link = """
            /opt/intel/mkl/lib/intel64/libmkl_blas95_lp64.a
            /opt/intel/mkl/lib/intel64/libmkl_lapack95_lp64.a
            -L/opt/intel/mkl/lib/intel64
            -lmkl_intel_lp64
            -lmkl_core
            -lmkl_intel_thread
            -lpthread
            -lm
            -ldl    
        """,
        error_regex = '(error #|ld:)',

        warning_regex = '(warning #|remark #)',
    )


    # needed to load mkl
    # see: https://answers.launchpad.net/dolfin/+question/205219
    import ctypes
    ctypes.CDLL('libmkl_rt.so', ctypes.RTLD_GLOBAL)
    ctypes.CDLL('/opt/intel/lib/intel64/libiomp5.so', ctypes.RTLD_GLOBAL)


问题


面经


文章

微信
公众号

扫码关注公众号