我可以键入提示actype类型吗
from ctypes import *
def wrap_function(library: str, name: str, restype, argtypes) -> *What goes here*:
"""Simplify wrapping ctypes functions"""
func = library.__getattr__(name)
func.restype = restype
func.argtypes = argtypes
return func
检查我在获取^{
我试过了
ctypes.POINTER(ctypes.CFUNCTYPE)
但它失败了
Traceback (most recent call last):
File "<input>", line 1, in <module>
TypeError: must be a ctypes type
CFUNCTYPE
是一个函数原型,而不是ctypes
类型。 您可以使用CFUNCTYPE
定义函数类型,然后将其包装在指针中,例如您可以使用定义的类型来输入提示。我看到你在试图“简化”包装。但是,当函数的目的是返回具有动态类型的函数时,不能引入静态类型
相关问题 更多 >
编程相关推荐