c++ - Cython:ctypedef 函数?

标签 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)

最佳答案

是的,这完全有可能:

ctypedef void (*function_type_name)(int, int)

关于c++ - Cython:ctypedef 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8881802/

相关文章:

c++ - 从参数的返回类型推断类型

c++ - fatal error : mpi. h : No such file or directory #include <mpi. h>

c - C 中的函数 Procura Matriz : Comparison between pointer and integer [enabled by default] Warning

c++ - 对象 "is not a structure or union"如果临时传递给构造函数

C++,模板的非参数类型 : only const variables?

c - 如何将数字与 double 分开并将它们作为 int 存储在 C 中?

c - switch() 函数中区分整数和特殊字符

arrays - 如何在PL/SQL函数中使用传递数组

c++ - 我无法使用 C++ 访问类的属性

c++ - 对结构С++的误解