Skip to content

8.1 Using Plugins

As of version 2.0 FEBio supports plugins. Plugins are dynamic libraries that extend the capabilities of FEBio at runtime without the need to recompile the entire source code. This offers the user a powerful mechanism for extending the default feature set of FEBio with little effort. In addition, the development of the plugin is independent of the FEBio source code, which implies that upgrading to a newer version of FEBio will not require a recompilation of the plugin1. Using plugins, users can create custom materials, boundary conditions, loads, output variables, etc., and even couple FEBio to other codes.

The FEBio Developer's Manual explains in detail how to create these plugins. In this section we outline how to use the plugins with FEBio.

A plugin is compiled into a dynamic library (dll or dylib) or shared object (so) and contains the compiled code of the library. In order to use this plugin, you must add the path to the plugin file in the FEBio configuration file (see ChapterĀ 7 for a discussion of the configuration file). For each plugin, an import item has to be added in this configuration file. For example,

<import>myplugin.dll</import>

You may need to add the full path to the plugin if FEBio has problems locating the plugin.

<import>C:\backslashpath\backslashto\backslashmy\backslashplugins\backslashmyplugin.dll</import>

When FEBio starts, it will first load all the plugins that are defined in the configuration file before it reads the input file. This way, sections in the input file that require the plugin's capabilities will already be available for use.

An alternative way for loading a plugin is using the -import command line option.

>febio -i input.feb -import myplugin.dll

In this example, FEBio will look for the file myplugin.dll in the current working directory. If the plugin file is located in a different folder than the current working directory, you must prepend the relative or absolute path to the file. Note that if the path contains spaces, you need to wrap it in quotes.

>febio -i input.feb -import "C:\backslashpath\backslashto\backslashmy custom plugin\backslashmyplugin.dll"

  1. When upgrading to a newer version of FEBio, it may be necessary to recompile the plugin if the plugin interface was changed. As long as the plugin remains compatible with the new interface, no code changes are required. ↩