Fixed bug in PluginFactory.cpp where plugins may not be loaded when they should be.

This commit is contained in:
Casey Langen 2016-05-28 18:36:52 -07:00
parent 878bbba514
commit ce408dc951

View File

@ -40,6 +40,7 @@
#include <core/config.h> #include <core/config.h>
#include <core/support/Common.h> #include <core/support/Common.h>
#include <core/debug.h> #include <core/debug.h>
#include <iostream>
static const std::string TAG = "PluginFactory"; static const std::string TAG = "PluginFactory";
static boost::mutex instanceMutex; static boost::mutex instanceMutex;
@ -93,7 +94,6 @@ void PluginFactory::LoadPlugins(){
std::string filename(file->path().string()); std::string filename(file->path().string());
#ifdef WIN32 #ifdef WIN32
/* if the file ends with ".dll", we'll try to load it*/ /* if the file ends with ".dll", we'll try to load it*/
if (filename.substr(filename.size() - 4) == ".dll") { if (filename.substr(filename.size() - 4) == ".dll") {
HMODULE dll = LoadLibrary(u8to16(filename).c_str()); HMODULE dll = LoadLibrary(u8to16(filename).c_str());
@ -115,7 +115,6 @@ void PluginFactory::LoadPlugins(){
#elif __APPLE__ #elif __APPLE__
if (filename.substr(filename.size() - 6) == ".dylib") { if (filename.substr(filename.size() - 6) == ".dylib") {
void* dll = NULL; void* dll = NULL;
char* err;
try { try {
dll = dlopen(filename.c_str(), RTLD_LOCAL); dll = dlopen(filename.c_str(), RTLD_LOCAL);
@ -125,7 +124,9 @@ void PluginFactory::LoadPlugins(){
continue; continue;
} }
if (err != NULL || (err = dlerror()) != NULL) { if (!dll) {
char *err = dlerror();
musik::debug::err( musik::debug::err(
TAG, TAG,
"could not load shared library " + filename + "could not load shared library " + filename +