-
André Anjos authoredAndré Anjos authored
c_cpp_api.rst 1.75 KiB
C++ API
The C++ API of xbob.io
allows users to leverage from automatic converters
for classes in :py:class:`xbob.io`. To use the C API, clients should first,
include the header file <xbob.io/api.h>
on their compilation units and
then, make sure to call once import_xbob_io()
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.io/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_blitz_array();
// imports xbob.core.random C-API
import_xbob_io();
}
Note
The include directory can be discovered using :py:func:`xbob.io.get_include`.