__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:gil_load 作者: chrisjbillington 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号