diff options
Diffstat (limited to 'AudioManagerDaemon/src/CommandSender.cpp')
-rw-r--r-- | AudioManagerDaemon/src/CommandSender.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/AudioManagerDaemon/src/CommandSender.cpp b/AudioManagerDaemon/src/CommandSender.cpp index 113ea2b..841c520 100644 --- a/AudioManagerDaemon/src/CommandSender.cpp +++ b/AudioManagerDaemon/src/CommandSender.cpp @@ -8,12 +8,13 @@ #include "CommandSender.h" #include "command/CommandSendInterface.h" #include "pluginTemplate.h" + using namespace am; #define CALL_ALL_INTERFACES(...) \ std::vector<CommandSendInterface*>::iterator iter = mListInterfaces.begin(); \ std::vector<CommandSendInterface*>::iterator iterEnd = mListInterfaces.end(); \ - for (; iter<iterEnd;++iter) \ + for (; iter<iterEnd;++iter) \ { \ (*iter)->__VA_ARGS__; \ } @@ -23,6 +24,8 @@ const char* commandPluginDirectories[] = { "/home/christian/workspace/gitserver/ uint16_t commandPluginDirectoriesCount = sizeof(commandPluginDirectories) / sizeof(commandPluginDirectories[0]); CommandSender::CommandSender() + :mListInterfaces(), + mListLibraryHandles() { std::vector<std::string> sharedLibraryNameList; @@ -71,7 +74,8 @@ CommandSender::CommandSender() { //DLT_LOG(AudioManager,DLT_LOG_INFO, DLT_STRING("Loading Hook plugin"),DLT_STRING(iter->c_str())); CommandSendInterface* (*createFunc)(); - createFunc = getCreateFunction<CommandSendInterface*()>(*iter); + void* tempLibHandle=NULL; + createFunc = getCreateFunction<CommandSendInterface*()>(*iter,tempLibHandle); if (!createFunc) { @@ -88,11 +92,13 @@ CommandSender::CommandSender() } mListInterfaces.push_back(commander); + mListLibraryHandles.push_back(tempLibHandle); } } CommandSender::~CommandSender() { + unloadLibraries(); } @@ -229,5 +235,17 @@ void CommandSender::cbTimingInformationChanged(const am_mainConnectionID_t mainC CALL_ALL_INTERFACES(cbTimingInformationChanged(mainConnection,time)) } +void CommandSender::unloadLibraries(void) +{ + std::vector<void*>::iterator iterator=mListLibraryHandles.begin(); + for(;iterator<mListLibraryHandles.end();++iterator) + { + dlclose(*iterator); + } + mListLibraryHandles.clear(); +} + + + |