4. Utilities

emlearn.common.compile_executable(code_file: str, out_dir: str, name: str = 'main', include_dirs=[])[source]

Compile C code on the host.

Useful to integrate small C executables in a Python-based script or notebook. Uses distutil.ccompiler, same as what is used to build Python modules. Should work portably on all platforms.

Parameters:
  • code_file – Path to file with C code to compile

  • out_dir – Path to directory where output executable will be located

  • name – Base name of the executable

  • include_dirs – Include directories for C headers

Returns:

Path to executable

emlearn.common.get_include_dir() str[source]

Get the include directory with C headers for emlearn