Simple C++ (C++17) wrappers (makeFunc) to Python (2.7) with param-checks
Usage:
#include "py_utils/make_func.h"
long ftoi(double d) {
return d;
}
void initPython() {
PyObject *pyFunc;
Py_Initialize();
PyObject *main = PyImport_AddModule("__main__");
PyObject *global = PyModule_GetDict(main);
pyFunc = makePyFunc(ftoi);//using
PyDict_SetItemString(global, "ftoi", pyFunc);
Py_DECREF(pyFunc);
//...
}
See extra tests and examples at src/main.cpp