def make_symbol(ldlib, name, symbol, restype, argtypes):
""" Helper for library symbols generation
:param ldlib: loaded library reference
:param name: function call to use
:param symbol: library symbol to attach function to
:param restype: library symbol return type
:param argtypes: list of library symbol parameters
:return: None
"""
try:
ldlib[name] = ldlib.lib[symbol]
ldlib[name].restype = restype
ldlib[name].argtypes = argtypes
except AttributeError:
print ldlib.name, name, "import(%d): Symbol not found" % sys.exc_info()[-1].tb_lineno
except TypeError:
pass
except Exception as ex:
print name, "import(%d):" % sys.exc_info()[-1].tb_lineno, ex, type(ex)
评论列表
文章目录