This class provides methods for loading Field plugins from disk.
More...
#include <PluginLoader.h>
|
static void | loadPlugins () |
| Checks all paths in $FIELD3D_DSO_PATH and loads the plugins it finds. More...
|
|
This class provides methods for loading Field plugins from disk.
- Todo:
- Look into adding maya-style single-plugin load and unload functions
Definition at line 68 of file PluginLoader.h.
PluginLoader::PluginLoader |
( |
| ) |
|
PluginLoader::~PluginLoader |
( |
| ) |
|
void PluginLoader::loadPlugins |
( |
| ) |
|
|
static |
Checks all paths in $FIELD3D_DSO_PATH and loads the plugins it finds.
Definition at line 163 of file PluginLoader.cpp.
References getDirSos(), Msg::print(), Msg::SevWarning, and ClassFactory::singleton().
Referenced by ClassFactory::ClassFactory().
166 char *cptr = getenv(
"FIELD3D_DSO_PATH");
170 std::string path = cptr;
173 std::vector<std::string> paths;
174 const std::string delimiters =
":";
176 tokenize(path, delimiters, paths);
179 for (
unsigned int i = 0; i < paths.size(); i++) {
182 std::vector<std::string> sos;
188 for (
unsigned int j = 0; j < sos.size(); j++) {
189 std::string sofile = sos[j];
192 const std::string pathDelimiter =
"/";
193 std::vector<std::string> pluginName;
194 tokenize(sofile, pathDelimiter, pluginName);
196 bool pluginAlreadyLoaded =
false;
199 if (pluginName.size() > 0) {
203 pluginAlreadyLoaded =
true;
209 if (pluginAlreadyLoaded) {
213 if (pluginName.size() > 0) {
214 std::string lastName = pluginName[pluginName.size() -1];
220 void *handle = dlopen(sofile.c_str(), RTLD_GLOBAL|RTLD_NOW);
223 "Field3D Plugin loader: failed to load plugin: " << dlerror() <<
"\n";
232 dlsym(handle,
"registerField3DPlugin");
233 std::string msg =
"Initialized Field3D Plugin " + sofile;
235 char *dlsymError = dlerror();
242 "failed to init Field3D plugin " + sofile);
248 char *debugEnvVar = getenv(
"FIELD3D_DEBUG");
252 "Field3D plugin loader: failed to load "
253 "the symbol registerField3DPlugin");
static ClassFactory & singleton()
}
void print(Severity severity, const std::string &message)
Sends the string to the assigned output, prefixing the message with the severity. ...
static std::vector< std::string > ms_pluginsLoaded
List of plugins loaded.
bool getDirSos(std::vector< std::string > &sos, std::string &dir)
The documentation for this class was generated from the following files: