本文整理汇总了Python中_ctypes.dlclose方法的典型用法代码示例。如果您正苦于以下问题:Python _ctypes.dlclose方法的具体用法?Python _ctypes.dlclose怎么用?Python _ctypes.dlclose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类_ctypes
的用法示例。
在下文中一共展示了_ctypes.dlclose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _FreePLC
# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import dlclose [as 别名]
def _FreePLC(self):
"""
Unload PLC library.
This is also called by __init__ to create dummy C func proxies
"""
self.PLClibraryLock.acquire()
try:
# Unload library explicitely
if getattr(self, "_PLClibraryHandle", None) is not None:
dlclose(self._PLClibraryHandle)
# Forget all refs to library
self._InitPLCStubCalls()
finally:
self.PLClibraryLock.release()
return False
示例2: cleanup_lib
# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import dlclose [as 别名]
def cleanup_lib(self):
""" unload the previously loaded shared library """
if not self.using_openmp:
#this if statement is necessary because shared libraries that use
#OpenMP will core dump when unloaded, this is a well-known issue with OpenMP
logging.debug('unloading shared library')
_ctypes.dlclose(self.lib._handle)
示例3: close
# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import dlclose [as 别名]
def close(self):
if self.system == 'windows':
_ctypes.FreeLibrary(self.kunpeng._handle)
else:
handle = self.kunpeng._handle
del self.kunpeng
_ctypes.dlclose(handle)
示例4: deleteCB
# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import dlclose [as 别名]
def deleteCB(self, offset):
"""Free the state associated to @offset and delete it
@offset: gcc state offset
"""
flib = None
if is_win:
flib = _ctypes.FreeLibrary
else:
flib = _ctypes.dlclose
flib(self.states[offset]._handle)
del self.states[offset]
示例5: __del__
# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import dlclose [as 别名]
def __del__(self):
if self._lib and self._fd:
self._lib.uinput_destroy(self._fd)
self._fd = None
_ctypes.dlclose(self._lib._handle)
self._lib = None
示例6: close
# 需要导入模块: import _ctypes [as 别名]
# 或者: from _ctypes import dlclose [as 别名]
def close(self):
# unload the models on the C++ side
_unload_models = self.libptr.unload_models
_unload_models.restype = None
_unload_models.argtypes = [c.c_void_p]
self.libptr.unload_models(self._zpar_session_obj)
# clean up the data structures on the python side
if self.tagger:
self.tagger.cleanup()
if self.parser:
self.parser.cleanup()
if self.depparser:
self.depparser.cleanup()
# set all the fields to none to enable clean reuse
self.tagger = None
self.parser = None
self.depparser = None
self.modelpath = None
# clean up the CDLL object too so that upon reuse, we get a new one
_ctypes.dlclose(self.libptr._handle)
# pretty sure once the old object libptr was pointed to should
# get garbage collected at some point after this
self.libptr = None
self._zpar_session_obj = None