Legend:
Library
Module
Module type
Parameter
Class
Class type
Plugin loader.
This module handles the set of plugins, visible to the platform.
Plugins are looked at the following locations:
paths explicitly specified by a user (via library parameter);
paths specified by the BAP_PLUGIN_PATH environment variable (same syntax as PATH variable);
$prefix/lib/bap, where $prefix is the installation prefix, specified during the installation.
The latter destination is used by the bapbundle install command, so this is the default repository of plugins.
The plugin loader is an event driven system. Once, Plugins.run function is called, events of type Plugins.events will start to fire. By default they are intercepted by a logger, and by the default handler (see Plugins.run function description about the default handler). The logger will write the infromation about events, that is useful for debugging issues with plugins.
val list : ?library:string list->unit ->plugin list
list ?library () scans a list of directories, provided by a library parameter, and, finally, Config.libdir for files with a plugin extension.
val run :
?don't_setup_handlers:bool ->?library:string list->?exclude:string list->unit ->
unit
run ?library ?exclude load and execute all plugins that can be found in the library paths, and are not in the exclude list. The default event handler will abort the program if there is any Errored event occurs, a message will be printed to the standard output. If don't_setup_handlers option is chosen, then events are not treated, so that a host program may setup a more fine granular error handling.
val load :
?library:string list->?exclude:string list->unit ->(plugin, string * Core_kernel.Std.Error.t)Core_kernel.Std.Result.t list
load ?library ?exclude is like run, but will not setup handlers, and will return a result of loading. Each element of the list is either an Ok plugin if a plugin was successfully loaded, or Error (name,error) if a plugin with the given name failed with error.