【发布时间】:2019-08-16 03:24:22
【问题描述】:
这是我的 Cython 错误的最低可重现版本。代码在 C++ 中运行。
编译器告诉我错误 C2088 “+= 对于结构是非法的”。但是,它正在传递一个数组。
pyx 文件:
from libc.stdint cimport uint32_t as Card
from cpython cimport array
import array
cdef extern from "ace_eval.h":
void ACE_addcard(h, Card c)
def create_hand():
cdef array.array h = array.array('I',[0, 0, 0, 0, 0])
ACE_addcard(h, 257)
return h
从头部导入的函数是:
#define ACE_addcard(h,c) h[c&7]+=c,h[3]|=c
我也尝试过使用声明我的数组
cdef Card h[5]
【问题讨论】: