相关疑难解决方法(0)

SWIG C-to-Python Int Array

我试图使用swig从python中使用以下原型访问C函数:

int cosetCoding(int writtenDataIn, int newData, const int memoryCells, int *cellFailure, int failedCell);
Run Code Online (Sandbox Code Playgroud)

Swig创建.so没有问题,我可以将它导入到python中,但是当我尝试使用以下内容访问它时:

 cosetCoding.cosetCoding(10,11,8,[0,0,0,0,0,0,0,0],0)
Run Code Online (Sandbox Code Playgroud)

我得到以下回溯:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: in method 'cosetCoding', argument 4 of type 'int *'
Run Code Online (Sandbox Code Playgroud)

指针应该是一个int数组,其大小由memoryCells定义

c python linux swig

11
推荐指数
2
解决办法
8493
查看次数

标签 统计

c ×1

linux ×1

python ×1

swig ×1