【发布时间】:2012-01-12 09:30:28
【问题描述】:
我想通过 SWIG 将已知大小和类型的 numpy 数组传递给 C 函数
# .py
data = numpy.arange( N , dtype=numpy.int32 )
external_c_function( data )
# .i
extern void external_c_function( int32_t* data );
# .c
void external_c_function( int32_t* data)
{
// ...
}
不幸的是,我会得到一个错误:
TypeError: in method 'external_c_function', argument 1 of type 'int32_t *'
将 numpy 数组传递给 SWIG 的最简单方法是什么?
【问题讨论】: