Skip to content
Snippets Groups Projects
c_cpp_api.rst 4.83 KiB

C++ API

The C++ API of bob.io.base allows users to leverage from automatic converters for classes in :py:class:`bob.io.base`. To use the C API, clients should first, include the header file <bob.io.base/api.h> on their compilation units and then, make sure to call once import_bob_io_base() 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 <bob.io.base/api.h>

PyMODINIT_FUNC initclient(void) {

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

  if (!m) return;

  /* imports dependencies */
  if (import_bob_blitz() < 0) {
    PyErr_Print();
    PyErr_SetString(PyExc_ImportError, "cannot import extension");
    return 0;
  }

  if (import_bob_io_base() < 0) {
    PyErr_Print();
    PyErr_SetString(PyExc_ImportError, "cannot import extension");
    return 0;
  }

}

Generic Functions

Bob File Support

Bob HDF5 Support