diff options
Diffstat (limited to 'AudioManagerUtilities')
-rw-r--r-- | AudioManagerUtilities/include/TAmPluginTemplate.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/AudioManagerUtilities/include/TAmPluginTemplate.h b/AudioManagerUtilities/include/TAmPluginTemplate.h index 8034497..95523f1 100644 --- a/AudioManagerUtilities/include/TAmPluginTemplate.h +++ b/AudioManagerUtilities/include/TAmPluginTemplate.h @@ -94,19 +94,25 @@ template<class T> T* getCreateFunction(const std::string& libname, void*& librar template<class T> T* getDestroyFunction(const std::string& libname,void* libraryHandle) { logInfo("destroy : Trying to destroy : ",libname); + // cut off directories char* fileWithPath = const_cast<char*>(libname.c_str()); std::string libFileName = basename(fileWithPath); + // cut off "lib" in front and cut off .so end" std::string destroyFunctionName = "destroy" + libFileName.substr(3, libFileName.length() - 6); + + // get entry point from shared lib dlerror(); // Clear any existing error union { void* voidPointer; T* typedPointer; } functionPointer; + functionPointer.voidPointer = dlsym(libraryHandle, destroyFunctionName.c_str()); T* destroyFunction = functionPointer.typedPointer; + const char* dlsym_error = dlerror(); if (!destroyFunction || dlsym_error) { |