aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugger.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/plugger.h b/src/plugger.h
index 4faca92..b531fae 100644
--- a/src/plugger.h
+++ b/src/plugger.h
@@ -115,7 +115,17 @@ public:
115 115
116 void registerExternalPlugin( const char *sFName, const char *sPluginName ) 116 void registerExternalPlugin( const char *sFName, const char *sPluginName )
117 { 117 {
118 PluginReg *pReg = new PluginReg; 118 PluginReg *pReg = (PluginReg *)hPlugin[sPluginName];
119 if( pReg != NULL )
120 {
121 hPlugin.del( sPluginName );
122 dlclose( pReg->dlHandle );
123 delete pReg;
124 pReg = NULL;
125 }
126
127 pReg = new PluginReg;
128
119 pReg->bBuiltin = false; 129 pReg->bBuiltin = false;
120 pReg->dlHandle = dlopen( sFName, RTLD_NOW ); 130 pReg->dlHandle = dlopen( sFName, RTLD_NOW );
121 if( pReg->dlHandle == NULL ) 131 if( pReg->dlHandle == NULL )
@@ -165,6 +175,20 @@ public:
165 hObj.del( pPlug ); 175 hObj.del( pPlug );
166 } 176 }
167 177
178 void unloadAll()
179 {
180 std::list<PluginReg *>::iterator i;
181 for( i = lPlugin.begin(); i != lPlugin.end(); i++ )
182 {
183 if( (*i)->bBuiltin == false )
184 {
185 dlclose( (*i)->dlHandle );
186 }
187 delete (*i);
188 }
189 hPlugin.clear();
190 }
191
168private: 192private:
169 std::list<PluginReg *> lPlugin; 193 std::list<PluginReg *> lPlugin;
170 HashTable hPlugin; 194 HashTable hPlugin;