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

Fixed Linux compilation error. Since dlopen() doesn't support RTLD_FIRST on...

Fixed Linux compilation error.  Since dlopen() doesn't support RTLD_FIRST on Linux, both plugin initializer functions are now mandatory.
parent bfb36258
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* Biological Structures at Stanford, funded under the NIH Roadmap for * * Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org. * * Medical Research, grant U54 GM072970. See https://simtk.org. *
* * * *
* Portions copyright (c) 2009 Stanford University and the Authors. * * Portions copyright (c) 2009-2011 Stanford University and the Authors. *
* Authors: Peter Eastman * * Authors: Peter Eastman *
* Contributors: * * Contributors: *
* * * *
...@@ -33,24 +33,23 @@ ...@@ -33,24 +33,23 @@
* -------------------------------------------------------------------------- */ * -------------------------------------------------------------------------- */
/** /**
* This file contains declarations for initialization functions that may be defined * This file contains declarations for initialization functions that must be defined
* by plugins, and that are invoked after the plugins have been loaded. There are * by plugins, and that are invoked after the plugins have been loaded. There are
* two such functions: one for registering new Platforms, and one for adding new * two such functions: one for registering new Platforms, and one for adding new
* KernelFactories to existing Platforms. Each of these functions is optional; most * KernelFactories to existing Platforms.
* plugins implement one or the other of them, but not both.
*/ */
/** /**
* If a plugin defines a new Platform, it should define this function. It will be * This function registers new Platforms that are defined by the plugin. It will be
* invoked after the plugin is loaded, and should register the new Platform by * invoked after the plugin is loaded, and should register the new Platforms by
* calling Platform::registerPlatform(). * calling Platform::registerPlatform().
*/ */
extern "C" void registerPlatforms(); extern "C" void registerPlatforms();
/** /**
* If a plugin defines a new KernelFactory for an existing Platform, it should define * This function registers new KernelFactories for existing Platforms.
* this function. It will be invoked after the plugin is loaded, and should register * It will be invoked after the plugin is loaded, and should register
* the new factory by calling registerKernelFactory() on the appropriate Platform object. * the new factories by calling registerKernelFactory() on the appropriate Platform objects.
* It is not invoked until after registerPlatforms() has been called on every plugin, * It is not invoked until after registerPlatforms() has been called on every plugin,
* thus avoiding initialization order problems when one plugin adds a KernelFactory * thus avoiding initialization order problems when one plugin adds a KernelFactory
* to a Platform defined by another plugin. * to a Platform defined by another plugin.
......
...@@ -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 | RTLD_FIRST); void *handle = dlopen(file.c_str(), RTLD_LAZY | RTLD_GLOBAL);
if (handle == NULL) if (handle == NULL)
throw OpenMMException("Error loading library "+file+": "+dlerror()); throw OpenMMException("Error loading library "+file+": "+dlerror());
return handle; return handle;
......
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