diff --git a/src/wrapper/Plumed.h b/src/wrapper/Plumed.h index 3ea2bc9c75..bf133661cb 100644 --- a/src/wrapper/Plumed.h +++ b/src/wrapper/Plumed.h @@ -4015,6 +4015,8 @@ void plumed_retrieve_functions(plumed_plumedmain_function_holder* functions, plu void* p; char* debug; int dlopenmode; + /* possible value of PLUMED_LOAD_NAMESPACE environment variable */ + char *load_namespace; g.create=__PLUMED_WRAPPER_CXX_NULLPTR; g.cmd=__PLUMED_WRAPPER_CXX_NULLPTR; g.finalize=__PLUMED_WRAPPER_CXX_NULLPTR; @@ -4045,7 +4047,8 @@ void plumed_retrieve_functions(plumed_plumedmain_function_holder* functions, plu __PLUMED_FPRINTF(stderr,"+++ PLUMED_KERNEL=\"%s\" +++\n",path); if(debug) __PLUMED_FPRINTF(stderr,"+++ Loading with mode RTLD_NOW"); dlopenmode=RTLD_NOW; - if(__PLUMED_GETENV("PLUMED_LOAD_NAMESPACE") && !__PLUMED_WRAPPER_STD strcmp(__PLUMED_GETENV("PLUMED_LOAD_NAMESPACE"),"GLOBAL")) { + load_namespace = __PLUMED_GETENV("PLUMED_LOAD_NAMESPACE"); + if(load_namespace && !__PLUMED_WRAPPER_STD strcmp(load_namespace,"GLOBAL")) { dlopenmode=dlopenmode|RTLD_GLOBAL; if(debug) __PLUMED_FPRINTF(stderr,"|RTLD_GLOBAL"); } else { @@ -4151,6 +4154,8 @@ plumed plumed_create(void) { plumed p; /* pointer to implementation */ plumed_implementation* pimpl; + /* possible value of PLUMED_LOAD_DLCLOSE environment variable */ + char *load_dlclose; /* allocate space for implementation object. this is free-ed in plumed_finalize(). */ pimpl=plumed_malloc_pimpl(); /* store pointers in pimpl */ @@ -4161,7 +4166,8 @@ plumed plumed_create(void) { #endif /* note if handle should not be dlclosed */ pimpl->dlclose=1; - if(__PLUMED_GETENV("PLUMED_LOAD_DLCLOSE") && !__PLUMED_WRAPPER_STD strcmp(__PLUMED_GETENV("PLUMED_LOAD_DLCLOSE"),"no")) pimpl->dlclose=0; + load_dlclose = __PLUMED_GETENV("PLUMED_LOAD_DLCLOSE"); + if(load_dlclose && !__PLUMED_WRAPPER_STD strcmp(load_dlclose,"no")) pimpl->dlclose=0; /* in case of failure, return */ /* the resulting object should be plumed_finalized, though you cannot use plumed_cmd */ if(!pimpl->functions.create) {