python.cooked

Helper functions to interact with the Python C API

Members

Functions

createModule
auto createModule()

Creates a Python3 module from the given C functions. Each function has the same name in Python.

initModule
void initModule()

Calls Py_InitModule. It's the Python2 way of creating a new Python module. Each function has the same name in Python.

pyMethodDef
auto pyMethodDef(F cfunction)

Helper function to create PyMethodDef structs. The strings are compile-time parameters to avoid passing GC-allocated memory to Python (by calling std.string.toStringz or manually appending the null terminator).

Meta