Skip to content

Simple C++ (C++17) wrappers (makeFunc) to Python (2.7) with param-checks

License

Notifications You must be signed in to change notification settings

TrueCat17/cpp-wrappers-to-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

cpp-wrappers-to-python

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

About

Simple C++ (C++17) wrappers (makeFunc) to Python (2.7) with param-checks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages