C API

q3py exposes a C API as a Python Capsule, which can be used directly by other native Python extensions.

All of the following can be found in q3py’s public header file include/q3py.h.

intptr_t q3py_syscall(intptr_t number, ...)

New in version 0.0.1.

Invokes a Quake 3 syscall.

Parameters:
  • number – The number of the syscall
  • ... – The arguments for the syscall
Returns:

The result of the syscall

int import_q3py()

New in version 0.0.1.

Imports the q3py Python capsule into Q3Py_API.

Warning

This needs to be called before any other q3py function, otherwise you will get a nice SEGFAULT.

Returns:0 on success, -1 on error
void** Q3Py_API

New in version 0.0.1.

Holds a pointer to the q3py Python capsule.

Warning

Do not set this directly, use import_q3py() instead!