现在我用Python了:
import ctypes
class base:
hello = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_int)
class sub(ctypes.Structure):
_fields_ = [('example', ctypes.c_int),
('hello', hello)] # Here I would like to use the
# "hello"-attribute from the base class
由于sub
- 类派生自ctypes.Structure
,我不确定如何从base
- 类派生它。
这样的话甚至是可能的,还是我需要在ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_int)
- 类中使用hello
代替sub
?
当然我愿意接受其他建议!