def get_func(libname, funcname, restype=None, argtypes=()):
"""Retrieve a function from a library, and set the data types."""
from ctypes import cdll
lib = cdll.LoadLibrary(libname)
func = getattr(lib, funcname)
func.argtypes = argtypes
func.restype = restype
return func
评论列表
文章目录