def _load_lib(self, lib_path):
"""
Loads the libdivert library, and configuring its arguments type
:param lib_path: The OS path where to load the libdivert.so
:return: None
"""
self._lib = cdll.LoadLibrary(lib_path)
# set the types of parameters
for func_name, argtypes in self.divert_argtypes.items():
# first check if function exists
if not hasattr(self._lib, func_name):
raise RuntimeError("Not a valid libdivert library")
setattr(getattr(self._lib, func_name), "argtypes", argtypes)
# set the types of return value
for func_name, restype in self.divert_restypes.items():
setattr(getattr(self._lib, func_name), "restype", restype)
macdivert.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录