Lets say I have float x from main
import progC
def main():
x = 3
y=progC(x)
print y
if __name__ == __main__
main()
#include <Python.h>
static PyObject* py_bracket(PyObject* self, float x){
x = x+5;
return Py_BuildValue("d",x);
}
ok problem is my float x in my C program receiving 0 not the number 3 from python
Try this:
static PyObject* py_bracket(PyObject* self, PyObject* args){
float x;
if (!PyArg_ParseTuple(args, "f", &x))
return NULL;
x = x+5;
return Py_BuildValue("f",x);
}