8000 Plugin: Add close method to PluginRegistry · Pagghiu/SaneCppLibraries@9e48369 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 9e48369

Browse files
committed
Plugin: Add close method to PluginRegistry
1 parent d5544f3 commit 9e48369

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.vscode/tasks.json

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
"default",
4040
"arm64"
4141
],
42+
"linux": {
43+
"options": {"env": {"CXX":"g++", "CC":"gcc"}}
44+
},
4245
"problemMatcher": [
4346
"$gcc"
4447
],
@@ -87,6 +90,9 @@
8790
"default",
8891
"arm64"
8992
],
93+
"linux":{
94+
"options": {"env": {"CXX":"g++", "CC":"gcc"}}
95+
},
9096
"problemMatcher": [
9197
"$gcc"
9298
],

Libraries/Plugin/Plugin.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,21 @@ SC::Result SC::PluginDynamicLibrary::load(const PluginCompiler& compiler, const
696696
return Result(true);
697697
}
698698

699+
SC::Result SC::PluginRegistry::close()
700+
{
701+
Result result(true);
702+
for (size_t idx = 0; idx < getNumberOfEntries(); ++idx)
703+
{
704+
Result res = unloadPlugin(getIdentifierAt(idx).view());
705+
if (not res)
706+
{
707+
// We still want to continue unload all plugins
708+
result = res;
709+
}
710+
}
711+
return result;
712+
}
713+
699714
SC::Result SC::PluginRegistry::replaceDefinitions(Vector<PluginDefinition>&& definitions)
700715
{
701716
SmallVector<String, 16> librariesToUnload;

Libraries/Plugin/Plugin.h

+3
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ struct SC::PluginDynamicLibrary
220220
/// @brief Holds a registry of plugins, loading and compiling them on the fly
221221
struct SC::PluginRegistry
222222
{
223+
/// @brief Unregisters all plugins
224+
Result close();
225+
223226
/// @brief Appends the definitions to registry
224227
/// @param definitions found plugin definitions
225228
/// @return Valid Result if definitions have been replaced successfully

0 commit comments

Comments
 (0)
0