Skip to content
Snippets Groups Projects
c_cpp_api.rst 1.61 KiB

C++ API

The C++ API of xbob.machine allows users to leverage from automatic converters for classes in :py:class:`xbob.machine`. To use the C API, clients should first, include the header file <xbob.machine/api.h> on their compilation units and then, make sure to call once import_xbob_machine() at their module instantiation, as explained at the Python manual.

Here is a dummy C example showing how to include the header and where to call the import function:

#include <xbob.machine/api.h>

PyMODINIT_FUNC initclient(void) {

  PyObject* m Py_InitModule("client", ClientMethods);

  if (!m) return;

  // imports the NumPy C-API
  import_array();

  // imports blitz.array C-API
  import_xbob_blitz();

  // imports xbob.io C-API
  import_xbob_io();

  // imports xbob.machine C-API
  import_xbob_machine();

}

Note

The include directory can be discovered using :py:func:`xbob.machine.get_include`.

Activation Support