Name
REQUIRE -- declare a plugin dependency (V5.0)
Synopsis
@REQUIRE plugin$[, table]
Library
plugin

Function
This preprocessor command loads and initializes the plugin specified by plugin$. Note that plugin$ must not contain any absolute or relative path specifications but just the name of the plugin to be loaded. Hollywood will then look for the plugin in its standard plugin search paths. See Plugins installation for details. Optionally, you can pass additional parameters to the plugin which allows you to control how the plugin is initialized.

Please note that even if you have set the AutoLoadPlugins tag in the @OPTIONS preprocessor command to True to tell Hollywood to automatically load all plugins on startup, many plugins will still require you to call @REQUIRE before they can be used. This is because these plugins need custom initialization code which is only run if you explicitly call @REQUIRE on them. For example, plugins which install a display adapter will not be activated unless you call @REQUIRE on them.

Plugins which just add a loader or saver for additional file formats, however, will often be automatically activated even if you don't call @REQUIRE on them. Still, it is recommended that you call @REQUIRE on every plugin your script requires because when compiling your script into an executable, only the plugins that your script has declared as mandatory using the @REQUIRE preprocessor command will be loaded by the executable (this behaviour can be modified by setting the AutoLoadPlugins tag to True in the @OPTIONS preprocessor command).

The @REQUIRE preprocessor command can also be used to load plugins which have been exempt from automatic loading at startup. Plugins can be exempt from auto-loading by prefixing their filename with an underscore character ('_') or by using the ‘-skipplugins’ console argument. If you want to load a plugin that has been skipped by the auto loader, just call @REQUIRE on it from your script and it will be loaded by the preprocessor. Alternatively, you can also load these plugins using the LoadPlugin() function.

Starting with Hollywood 6.0 this preprocessor command accepts an optional table argument which allows you to pass additional parameters to the plugin's initialization routine. The parameters accepted here vary from plugin to plugin. Please consult the documentation of the plugin to find out if it accepts any additional parameters that can be passed to @REQUIRE. The following three parameters are supported for every plugin:

Version:
Minimum plugin version required. Hollywood will fail if the installed plugin does not have at least this version number. This defaults to 0 which means that any version will do. (V6.0)

Revision:
Minimum plugin revision required. Hollywood will fail if the installed plugin does not have at least this revision number. This defaults to 0 which means that any revision will do. (V6.0)

Link:
If this tag is set to True, the specified plugin will be linked into your executable when compiling your script. This will only work if you've set up the plugin linker infrastructure correctly. See Linking plugins for details. Make sure to carefully read the licenses of all plugins you link to your executable because licenses like LGPL affect your project if you statically link against LGPL software. This tag defaults to False which means that the plugin won't be linked. (V7.0)

Please note that you must not specify an absolute path in plugin$. Just pass the name of the plugin.

See Plugins for more information on plugins.

Inputs
plugin$
name of the required plugin
table
optional: table containing further options to be passed to the plugin (V6.0)
Example
@REQUIRE "xml"
Declares that your script requires the "xml.hwp" plugin to be installed. Any version will be accepted.


@REQUIRE "myplugin", {Version = 2, Revision = 1, User = "John"}
The code above checks for version 2.1 of "myplugin.hwp" and also passes the additional argument "User=John" to the plugin's initialization code.

Show TOC