Problem on Python/C++
wangye1 at auburn.edu
Sun Sep 30 17:26:01 CEST 2001
When I use the Python and C, I have this problem. How can I call Python
function from C code.
What I am trying is to define a function pointer in C code and make a
method in interface file ( I use SWIG) which sets the pointer to the
function in Python.
--------------This is in interface file------------
//Grab a Python function as a Python object
%typemap(python,in) PyObject *pyfunc
PyErr_SetString (PyExc_TypeError, "Need a callable object!");
$target = $source;
void set_pymethod(PyObject *pyfunc)
The problem is when I compile, it return a error in set_pymethod that it
can not convert the PyObject * to int (*())().
Thanks for any help!!
More information about the Python-list