函数指针作为参数赋值 案例 #include<stdio.h> void show() { printf("%s\n",__FUNCTION__); } void cool(void(**s)()){ *s = &show; } ~ 赋值的是show 文件名编译 gcc -fPIC --shared test.c -o test.so python 代码 import ctypes VOID_T = ctypes.CFUNCTYPE(None) t = VOID_T() handle=ctypes.CDLL("./test.so") handle.cool.argtypes=[ctypes.POINTER(VOID_T)] handle.cool(ctypes.pointer(t)) t() 执行 输出函数名show.