Cython:ctypedef函数?

时间:2012-01-16 15:01:18

标签: c++ c function typedef cython

是否可以ctypedef一个函数,因为它是C ++中的常见模式?像

typedef int (*foo)(int, double, char*)

# Cython equivalent
ctypedef int (*foo)(int, double, char*)

或者至少在没有直接声明的情况下对它进行外包?

类似的东西
# myheader.h
typedef int (*foo)(int, double, char*)

# mytest.pyx
extern int (*foo)

1 个答案:

答案 0 :(得分:8)

是的,这完全可能:

ctypedef void (*function_type_name)(int, int)