Commit ffcf55d9 authored by Peter Eastman's avatar Peter Eastman
Browse files

Fixed a bug that caused platforms to be registered twice if another plugin linked to them

parent 5b5ddfbf
...@@ -182,7 +182,7 @@ static void initializePlugins(vector<HMODULE>& plugins) { ...@@ -182,7 +182,7 @@ static void initializePlugins(vector<HMODULE>& plugins) {
} }
#else #else
static void* loadOneLibrary(const string& file) { static void* loadOneLibrary(const string& file) {
void *handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_GLOBAL); void *handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_GLOBAL | RTLD_FIRST);
if (handle == NULL) if (handle == NULL)
throw OpenMMException("Error loading library "+file+": "+dlerror()); throw OpenMMException("Error loading library "+file+": "+dlerror());
return handle; return handle;
...@@ -249,7 +249,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) { ...@@ -249,7 +249,7 @@ vector<string> Platform::loadPluginsFromDirectory(const string& directory) {
try { try {
plugins.push_back(loadOneLibrary(directory+dirSeparator+files[i])); plugins.push_back(loadOneLibrary(directory+dirSeparator+files[i]));
loadedLibraries.push_back(files[i]); loadedLibraries.push_back(files[i]);
} catch (OpenMMException ex) { } catch (OpenMMException& ex) {
// Just ignore it. // Just ignore it.
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment