You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using UniquePtr = std::unique_ptr<Base, DeleterType<Base>>;
84
+
#endif
85
+
78
86
/**
79
87
* @brief Constructor for ClassLoader
80
88
* @param library_path - The path of the runtime library to load
@@ -100,54 +108,66 @@ class ClassLoader
100
108
}
101
109
102
110
/**
103
-
* @brief Generates an instance of loadable classes (i.e. class_loader). It is not necessary for the user to call loadLibrary() as it will be invoked automatically if the library is not yet loaded (which typically happens when in "On Demand Load/Unload" mode).
111
+
* @brief Generates an instance of loadable classes (i.e. class_loader).
112
+
*
113
+
* It is not necessary for the user to call loadLibrary() as it will be invoked automatically
114
+
* if the library is not yet loaded (which typically happens when in "On Demand Load/Unload" mode).
115
+
*
104
116
* @param derived_class_name The name of the class we want to create (@see getAvailableClasses())
105
117
* @return A std::shared_ptr<Base> to newly created plugin object
/// Generates an instance of loadable classes (i.e. class_loader).
134
154
/**
135
-
* @brief Generates an instance of loadable classes (i.e. class_loader). It is not necessary for the user to call loadLibrary() as it will be invoked automatically if the library is not yet loaded (which typically happens when in "On Demand Load/Unload" mode).
136
-
* @param derived_class_name The name of the class we want to create (@see getAvailableClasses())
155
+
* It is not necessary for the user to call loadLibrary() as it will be
156
+
* invoked automatically if the library is not yet loaded (which typically
157
+
* happens when in "On Demand Load/Unload" mode).
158
+
*
159
+
* Creating an unmanaged instance disables dynamically unloading libraries
160
+
* when managed pointers go out of scope for all class loaders in this
161
+
* process.
162
+
*
163
+
* @param derived_class_name
164
+
* The name of the class we want to create (@see getAvailableClasses()).
137
165
* @return An unmanaged (i.e. not a shared_ptr) Base* to newly created plugin object.
138
166
*/
139
167
template <classBase>
140
168
Base * createUnmanagedInstance(const std::string & derived_class_name)
141
169
{
142
-
has_unmananged_instance_been_created_ = true;
143
-
if (!isLibraryLoaded()) {
144
-
loadLibrary();
145
-
}
146
-
147
-
Base * obj = class_loader::impl::createInstance<Base>(derived_class_name, this);
148
-
assert(obj != nullptr); // Unreachable assertion if createInstance() throws on failure
* @brief As the library may be unloaded in "on-demand load/unload" mode, unload maybe called from createInstance(). The problem is that createInstance() locks the plugin_ref_count as does unloadLibrary(). This method is the implementation of unloadLibrary but with a parameter to decide if plugin_ref_mutex_ should be locked
247
320
* @param lock_plugin_ref_count - Set to true if plugin_ref_count_mutex_ should be locked, else false
0 commit comments