Table Of Contents

Previous topic

Reference Counting

Next topic


Initialization, Finalization and Logging


The Speect engine must be initialized before any calls are made to any Speect functions. Most functionality of the Speect engine can only be used after it has been initialized. The basic initialization function is speect_init(). This initializes the logging mechanism (see logging below), the error handling module, and the object system. The default plug-in path is also set.

Default plug-in path

The default plug-in path is calculated based on a guess of the location of the Speect installation, or where Speect was built. When Speect is built, a file plugin.lib is created in the speect/build/plugins/lib/ directory, and when Speect is installed that file is created in the CMAKE_INSTALL_PREFIX/speect/plugins directory. During initialization the plugin.lib file is looked for in these two locations, with the installation location taking preference.

The user can override this behavior by setting the environment variable


Environment variable pointing to the Speect plug-ins path.

which will take preference over the installation and build locations.


One should finalize Speect after using it. Finalizing Speect will close the logging system, free up resources taken by the object system and quit the error handling module.

The finalization function is speect_quit().


The speect_init() function takes a logger (s_logger) as an argument. If NULL then Error handling and Debugging logging will be set as follows:

  • if CMAKE_BUILD_TYPE is set to Debug then logging will be written to the stderr stream, otherwise
  • no logging will be done.

A file or console logger can be created with the functions s_logger_file_new() and s_logger_console_new(), which can then be passed to speect_init(). All logging of the error handling module will then be done to the passed logger. The function pointers of s_logger can also be used to create callbacks to other loggers, as in the Python logger in speect/engine/swig/python/native/py_logger.c.