我正在将 ac 库集成到 python 应用程序。为了理解,我需要将变量列表从 python 大小传递给 C lib(我正在调用)的包装器,我编写了一个小程序:
在 python 应用程序中加载共享库之后。在 Python 方面:
c_args = [5,6]
PyPrintVal(c_args)
在C端:
PyPrintVal(PyObject *c_args)
{
int i=0;
int j=0;
printf("In eINoiseRemoval\n");
if (!PyArg_ParseTuple(c_args, "ii", &i,&j))
{ fprintf(stderr, "error in parsing\n");
return -1;
}
printf(i1=%d j=%d\n, i,j)
}
然后我得到分段错误?还剩下什么吗?
为此,我正在寻找http://docs.python.org/2/extending/extending.html#a-simple-example
但没有得到任何答案。谢谢