Skip to content

Utility functions and macros

Stefan Richthofer edited this page Sep 14, 2018 · 4 revisions

There are a number of useful utility functions and macros, mostly in JyNI.c, this page aims to document them so that future developers don't have to hunt for them or re-write them.

Arguably the most useful functions in JyNI are JyNI_JythonPyObject_FromPyObject(PyObject* ob) and JyNI_PyObject_FromJythonPyObject(jobject ob). These functions convert between the Jython jobject representing the object and the C PyObject* representing the object. For this to work, there needs to be an entry in the builtin types map, and the object needs to have been initialised properly.

JyNI_PyObject_Call(jobject callable, PyObject* args, PyObject* kw) not only converts args and kw to jobjects but also converts them to Jython's calling convention and makes a proper call to the callable Jython PyObject.