Plug-In Support

TEMU is build as a set of plug-ins. Almost every model, including the processor models are located in plugins that are loaded at run-time.

A plugin can be loaded using the command plugin-load (aliased as import). Or the API function temu_loadPlugin(). Loading is done in the following way:

  1. If the plugin contains a directory separator (i.e. a '/' on Linux and macOS). Then the plugin is loaded directly, assuming it is a file.

  2. If the plugin does not contain a directory separator, then TEMU first tries to find the plugin in the internal plugin path. That path can be manipulated with the commands: plugin-append-path and plugin-remove-path. The current path can also be printed using plugin-show-path. The plugin path is searched, attempting to locate the plugin with the name libTEMU<plugin-name>.so first, and secondly as lib<plugin-name>.so.

  3. If the plugin is not found in the internal plugin path, then a last attempt is made to use the system library paths. When falling back to the system paths, then the plugin must be named libTEMU<plugin-name>.so.

When a plugin is loaded, the first thing that is done is to execute the temu_pluginInit() function that must be implemented in the plugin. That function typically registers classes and commands with the TEMU runtime.