seg violation using pycapsule_new
Posted
by
user1733051
on Stack Overflow
See other posts from Stack Overflow
or by user1733051
Published on 2012-10-25T16:57:40Z
Indexed on
2012/10/25
17:00 UTC
Read the original article
Hit count: 144
I am trying some simple c API, where I am using PyCapsule_New to encapsulate a pointer. I am running into segment violation, can some body help me.
mystruct *func1(int streamno, char mode,unsigned int options) { char * s; s=malloc(100); return s; }
PyObject *Wrapper_func1(PyObject *self, PyObject *args)
{
int streamno;
char mode;
unsigned int options;
mystruct* result;
if (!PyArg_ParseTuple(args,"icI",&streamno,&mode,&options))
return NULL;
result = func1(streamno,mode,options);
return PyCapsule_New( result,NULL,NULL);
}
© Stack Overflow or respective owner