Reputation: 795
I am on integration of a c library to python application.
and i need to pass a list of variables from python size to a wrapper of C lib(which i am calling) just for understanding, i have written a small program:
After loading shared lib in python app.
In Python side:
c_args = [5,6]
PyPrintVal(c_args)
In C side:
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)
}
then I am getting segmentation fault ? Is there anything left?
for that i am looking http://docs.python.org/2/extending/extending.html#a-simple-example
but not getting any answer. Thanks
Upvotes: 1
Views: 78
Reputation: 17389
You can use gdb
to find out exactly where this segfault is:
$ gdb python
......
> set args my_python_script.py
> run
.......
Segmentation Fault
> where
This will give you a stack trace and point you to the exact location of the segfault.
Upvotes: 1