From 213faed28a80aeb189921207764491338ba487c6 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Wed, 15 Nov 2023 11:56:34 +0100 Subject: [PATCH 1/2] added a global switch to LOAD --- src/core/PlumedMain.cpp | 30 +++++++++++++++++------------- src/core/PlumedMain.h | 2 +- src/setup/Load.cpp | 5 ++++- src/tools/DLLoader.cpp | 8 ++++++-- src/tools/DLLoader.h | 16 ++++++++-------- 5 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/core/PlumedMain.cpp b/src/core/PlumedMain.cpp index 40c9f4376c..7728a3ad4b 100644 --- a/src/core/PlumedMain.cpp +++ b/src/core/PlumedMain.cpp @@ -1058,38 +1058,42 @@ void PlumedMain::update() { } } -void PlumedMain::load(const std::string& ss) { +void PlumedMain::load(const std::string& fileName, const bool loadGlobal) { if(DLLoader::installed()) { - std::string s=ss; - size_t n=s.find_last_of("."); + std::string libName=fileName; + size_t n=libName.find_last_of("."); std::string extension=""; - std::string base=s; - if(n!=std::string::npos && n0) log<<" (only on master node)"; log<<"\n"; if(comm.Get_rank()==0) { int ret=std::system(cmd.c_str()); - if(ret!=0) plumed_error() <<"An error happened while executing command "< handles; std::string lastError; -/// Deleted copy constructor + /// Deleted copy constructor DLLoader(const DLLoader&) = delete; -/// Deleted assignment + /// Deleted assignment DLLoader&operator=(const DLLoader&) = delete; public: -/// Default constructor + /// Default constructor DLLoader(); -/// Cleanup + /// Cleanup ~DLLoader(); -/// Load a library, returning its handle + /// Load a library, returning its handle void* load(const std::string&); -/// Returns the last error in dynamic loader + /// Returns the last error in dynamic loader const std::string & error(); -/// Returns true if the dynamic loader is available (on some systems it may not). + /// Returns true if the dynamic loader is available (on some systems it may not). static bool installed(); }; -} +} // namespace PLMD #endif From 05ac10b2358ad8cadc83587984acb5e7ebb10888 Mon Sep 17 00:00:00 2001 From: Daniele Rapetti Date: Wed, 15 Nov 2023 12:11:26 +0100 Subject: [PATCH 2/2] wrong commit --- src/tools/DLLoader.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/DLLoader.h b/src/tools/DLLoader.h index b4a68c0d6e..312f1f3178 100644 --- a/src/tools/DLLoader.h +++ b/src/tools/DLLoader.h @@ -50,7 +50,7 @@ class DLLoader { /// Cleanup ~DLLoader(); /// Load a library, returning its handle - void* load(const std::string&); + void* load(const std::string&, bool=false); /// Returns the last error in dynamic loader const std::string & error(); /// Returns true if the dynamic loader is available (on some systems it may not).