From 6f38f2585f981e304b326e609f05af3be465574b Mon Sep 17 00:00:00 2001 From: Casey Langen Date: Tue, 14 Feb 2017 21:03:48 -0800 Subject: [PATCH] Fixed macOS/clang compile. --- src/core/plugin/PluginFactory.cpp | 2 +- src/core/plugin/PluginFactory.h | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/core/plugin/PluginFactory.cpp b/src/core/plugin/PluginFactory.cpp index f54b777dc..a5aa3ca2c 100644 --- a/src/core/plugin/PluginFactory.cpp +++ b/src/core/plugin/PluginFactory.cpp @@ -53,7 +53,7 @@ typedef musik::core::sdk::IPlugin* STDCALL(CallGetPlugin); static void closeNativeHandle(void* dll) { FreeLibrary((HMODULE)dll); } #else typedef musik::core::sdk::IPlugin* (*CallGetPlugin)(); -static void closeNativeHandle(void* dll) { dclose(dll); } +static void closeNativeHandle(void* dll) { dlclose(dll); } #endif PluginFactory& PluginFactory::Instance() { diff --git a/src/core/plugin/PluginFactory.h b/src/core/plugin/PluginFactory.h index fd3c23376..40cee83b3 100644 --- a/src/core/plugin/PluginFactory.h +++ b/src/core/plugin/PluginFactory.h @@ -71,7 +71,7 @@ namespace musik { namespace core { }; template void QueryInterface( - const char* functionName, + const std::string& functionName, std::function, const std::string&)> handler) { std::unique_lock lock(this->mutex); @@ -82,9 +82,9 @@ namespace musik { namespace core { if (functionName == "GetPlugin" || prefs->GetBool(descriptor->key.c_str(), true)) { /* enabled */ PluginInterfaceCall funcPtr = #ifdef WIN32 - (PluginInterfaceCall) GetProcAddress((HMODULE)(descriptor->nativeHandle), functionName); + (PluginInterfaceCall) GetProcAddress((HMODULE)(descriptor->nativeHandle), functionName.c_str()); #else - (PluginInterfaceCall)dlsym(descriptor->nativeHandle, functionName); + (PluginInterfaceCall)dlsym(descriptor->nativeHandle, functionName.c_str()); #endif if (funcPtr) { T* result = funcPtr(); @@ -97,7 +97,7 @@ namespace musik { namespace core { } } - template std::vector > QueryInterface(const char* functionName) { + template std::vector > QueryInterface(const std::string& functionName) { std::vector > plugins; QueryInterface( @@ -110,7 +110,7 @@ namespace musik { namespace core { } template void QueryFunction( - const char* functionName, + const std::string& functionName, std::function handler) { std::unique_lock lock(this->mutex); @@ -119,9 +119,9 @@ namespace musik { namespace core { if (prefs->GetBool(descriptor->key.c_str(), true)) { /* if enabled by prefs */ T funcPtr = #ifdef WIN32 - (T) GetProcAddress((HMODULE)(descriptor->nativeHandle), functionName); + (T) GetProcAddress((HMODULE)(descriptor->nativeHandle), functionName.c_str()); #else - (T)dlsym(descriptor->nativeHandle, functionName); + (T)dlsym(descriptor->nativeHandle, functionName.c_str()); #endif if (funcPtr) { handler(descriptor->plugin, funcPtr);