CopperSpice API  1.9.1
Plugin Deployment

This section explains how to deploy any required plugins with your CopperSpice application and then load at runtime.

Plugin Directory

Your application executable directory is referred to as the pluginsbase. This path can be anything which is appropriate for the given platform. As an example, suppose we have a Windows application which is installed to the path shown below. If the application requires the PostgreSQL plugin the following directory will be searched first.

// installation path
C:\Program Files\MyApp
// plugin path location for SQL drivers
C:\Program Files\MyApp\sqldrivers

CopperSpice will also look in the directory specified by QLibraryInfo::location(QLibraryInfo::PluginsPath). If your application should look in additional locations, use QCoreApplication::addLibraryPath() to add additional directories.

To override all the default locations use QCoreApplication::setLibraryPaths().

Configuration File

The cs.conf file can also be used to override the hard coded paths compiled into the CopperSpice library. For more information about the conf file refer to Plugin Path Configuration.

Environment Variable

You can also set the CS_PLUGIN_PATH environment variable before running your application. If this is set, CopperSpice will look for plugins in the paths (separated by the system path separator) specified in the variable.

Loading and Verifying Plugins

When loading a plugin it will be evaluated to determine whether or not the given plugin is a compatible version. This provides the ability to have multiple versions and configurations of CopperSpice and the plugin. Plugins linked with a CopperSpice library which have a higher version number will not be loaded by a library with a lower version number. Plugins linked with a CopperSpice library which have a lower major version number will not be loaded by a library with a higher major version number.

When building plugins it is important to ensure the plugin is configured the same way as your application. For example, if the application was built in release mode the plugin should also be built in release mode.