Hey gang, so I've written a swig wrapper for some C code. I'm trying to bridge the gap between scipy arrays and C arrays, which I know is messy. After a clean compilation (well...not including some warnings...) I'm getting this issue when I load the python-swig-c module:
undefined symbol: PyArray_TYPE
I've added my swig interface file below开发者_开发问答 - I've used the swig-pythonc tutorial to write this stuff:
%module pycimpl
%{
#define SWIG_FILE_WITH_INIT
#include "cimpl.h"
%}
%include "numpy.i"
%init %{
import_array();
%}
%include "typemaps.i"
%apply (double* INPLACE_ARRAY1, int DIM1, int* INPLACE_ARRAY2, int DIM2, int* INPLACE_ARRAY3, int DIM3, double* INPLACE_ARRAY4, int DIM4, double* OUTPUT) { (double a[], int adim, int rowidx[], int rowidxdim, int colstr[], int colstrdim, double x[], int xdim, double* zeta) }
double cimpl(double a[], int adim, int ridx[], int ridxdim, int cstr[], int cstrdim, double x[], int xdim, double* zeta);
%include "cimpl.h"
Any help would be greatly appreciated!
Cheers!
ct
Why don't you use ctypes or pyrex/cython instead of SWIG? (see Python: SWIG vs ctypes)
精彩评论