From 91d56cb5c5abddc701335917d08409b7cb55c5a1 Mon Sep 17 00:00:00 2001 From: Giovanni Bussi Date: Mon, 4 Dec 2023 17:34:47 +0100 Subject: [PATCH] Print library path in log file --- src/config/Config.h | 2 ++ src/config/Config.inc.in | 13 +++++++++++++ src/core/PlumedMain.cpp | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/config/Config.h b/src/config/Config.h index c5d3a319b7..1604c5bab6 100644 --- a/src/config/Config.h +++ b/src/config/Config.h @@ -107,6 +107,8 @@ bool hasExternalMolfile(); bool hasZlib(); +std::string getLibraryPath(); + } } diff --git a/src/config/Config.inc.in b/src/config/Config.inc.in index 484679d1c2..412bb27504 100644 --- a/src/config/Config.inc.in +++ b/src/config/Config.inc.in @@ -24,6 +24,7 @@ #include "version.h" #include #include +#include namespace PLMD { namespace config { @@ -177,6 +178,18 @@ std::string getCompilationTime() { return __TIME__; } +std::string getLibraryPath() { +#ifdef __PLUMED_HAS_DLADDR + Dl_info info; + if(dladdr((void*)getLibraryPath,&info)) { + return info.dli_fname; + } else { + return ""; + } +#endif + +} + } } diff --git a/src/core/PlumedMain.cpp b/src/core/PlumedMain.cpp index e64e4210e4..1762a92e07 100644 --- a/src/core/PlumedMain.cpp +++ b/src/core/PlumedMain.cpp @@ -65,7 +65,6 @@ #include #include - namespace PLMD { /// Small utility just used in this file to throw arbitrary exceptions @@ -757,6 +756,7 @@ void PlumedMain::init() { log<<"\n"; log<<"For further information see the PLUMED web page at http://www.plumed.org\n"; log<<"Root: "<