25 #ifndef YARP_NO_DEPRECATED // since YARP 3.4
33 #ifndef YARP_NO_DEPRECATED // since YARP 3.4
38 #endif // YARP_NO_DEPRECATED
41 const std::string& dll_name,
42 const std::string& fn_name)
44 return subopen(factory, dll_name, fn_name);
48 const std::string& dll_name,
49 const std::string& fn_name)
52 "Trying plugin [dll: %s] [fn: %s]",
55 bool ok = factory.
open(dll_name.c_str(), fn_name.c_str());
57 "Trying to find library '%s' containing function '%s' -- %s",
59 fn_name.c_str(), ok ?
"found" :
"fail");
62 "Found plugin [dll: %s] [fn: %s]",
65 this->dll_name = dll_name;
66 this->fn_name = fn_name;
70 "Error while opening %s:\n %s",
75 "Error while opening %s:\n %s",
86 "Plugin [name: %s] [dll: %s] [fn: %s]",
90 if (selector !=
nullptr && !name.empty()) {
93 Bottle paths = selector->getSearchPath();
94 for (
size_t i = 0; i < paths.
size(); i++) {
98 std::string basename = (dll_name.find(
'.') != std::string::npos) ? name : dll_name;
99 std::string fn = (fn_name.empty()) ? name : fn_name;
101 std::string fullpath;
103 #if defined(_MSC_VER) && !defined(NDEBUG)
105 fullpath = std::string(path).append(
"/").append(basename).append(
"d").append(ext);
106 if (subopen(factory, fullpath, fn))
108 #endif // defined(_MSC_VER) && !defined(NDEBUG)
111 fullpath = std::string(path).append(
"/").append(basename).append(ext);
112 if (subopen(factory, fullpath, fn)) {
116 #if defined(_MSC_VER) && defined(NDEBUG)
118 fullpath = std::string(path).append(
"/").append(basename).append(
"d").append(ext);
119 if (subopen(factory, fullpath, fn))
121 #endif // defined(_MSC_VER) && defined(NDEBUG)
128 # if defined(_MSC_VER) && !defined(NDEBUG)
130 fullpath = std::string(path).append(
"/" CMAKE_INTDIR
"/").append(dll_name).append(
"d").append(ext);
131 if (subopen(factory, fullpath, fn))
133 # endif // defined(_MSC_VER) && !defined(NDEBUG)
136 fullpath = std::string(path).append(
"/" CMAKE_INTDIR
"/").append(dll_name).append(ext);
137 if (subopen(factory, fullpath, fn))
140 # if defined(_MSC_VER) && defined(NDEBUG)
142 fullpath = std::string(path).append(
"/" CMAKE_INTDIR
"/").append(dll_name).append(
"d").append(ext);
143 if (subopen(factory, fullpath, fn))
145 # endif // defined(_MSC_VER) && defined(NDEBUG)
147 #endif // CMAKE_INTDIR
150 if (!dll_name.empty() || !fn_name.empty()) {
151 return open(factory, dll_name, fn_name);
153 return factory.
open((std::string(
"yarp_") + name).c_str(),
154 (fn_name.empty()) ? name.c_str() : fn_name.c_str());
165 yCDebug(YARPPLUGINSETTINGS,
"Cannot load plugin from shared library (%s)", dll_name.c_str());
169 yCWarning(YARPPLUGINSETTINGS,
"Cannot load plugin from shared library (%s)", dll_name.c_str());
173 yCWarning(YARPPLUGINSETTINGS,
"Cannot find YARP hook in shared library (%s:%s)", dll_name.c_str(), fn_name.c_str());
177 yCWarning(YARPPLUGINSETTINGS,
"YARP hook in shared library misbehaved (%s:%s)", dll_name.c_str(), fn_name.c_str());
178 yCWarning(YARPPLUGINSETTINGS,
"(the library may be too old/new and need to be recompiled to match YARP version)");
182 yCWarning(YARPPLUGINSETTINGS,
"Unknown error (%s:%s)", dll_name.c_str(), fn_name.c_str());
190 yCError(YARPPLUGINSETTINGS,
"Failed to create %s from shared library %s", fn_name.c_str(), dll_name.c_str());
193 bool YarpPluginSettings::readFromSelector(
const std::string& name)
197 Bottle plugins = selector->getSelectedPlugins();
201 "Cannot find \"%s\" plugin (not built in, and no .ini file found for it)"
202 "Check that YARP_DATA_DIRS leads to at least one directory with plugins/%s.ini "
203 "or share/yarp/plugins/%s.ini in it",
209 return readFromSearchable(group, name);
215 std::lock_guard<std::mutex> guard(mutex);
218 bool need_scan =
true;
219 if (config.check(
"last_update_time")) {
228 yCDebug(YARPPLUGINSETTINGS,
"Scanning. I'm scanning. I hope you like scanning too.");
236 if (plugin_paths.
size() == 0) {
237 plugin_paths = rf.
findPaths(
"share/yarp/plugins");
242 if (plugin_paths.
size() > 0) {
243 for (
size_t i = 0; i < plugin_paths.
size(); i++) {
244 std::string target = plugin_paths.
get(i).
asString();
245 yCDebug(YARPPLUGINSETTINGS,
"Loading configuration files related to plugins from %s.",
247 config.fromConfigDir(target,
"inifile",
false);
250 yCDebug(YARPPLUGINSETTINGS,
"Plugin directory not found");
257 for (
size_t i = 0; i < inilst.
size(); i++) {
261 for (
size_t i = 0; i < lst.
size(); i++) {
270 for (
size_t i = 0; i < lst.
size(); i++) {