Skip to content

Commit

Permalink
Corrected how the dlsym function are handled in Plumed.h with C++
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Jun 28, 2024
1 parent 63ed9f0 commit dc43934
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wrapper/Plumed.h
Original file line number Diff line number Diff line change
Expand Up @@ -3852,11 +3852,16 @@ __PLUMED_WRAPPER_INTERNALS_END
/**
Utility to search for a function.
*/
#ifdef __cplusplus
#define __PLUMED_WRAPPER_SEARCHF_CAST(func,tmpptr) func=reinterpret_cast<decltype (func)>(tmpptr)
#else
#define __PLUMED_WRAPPER_SEARCHF_CAST(func,tmpptr) *(void **)&func=tmpptr
#endif
#define __PLUMED_SEARCH_FUNCTION(tmpptr,handle,func,name,debug) \
if(!func) { \
tmpptr=dlsym(handle,name); \
if(tmpptr) { \
*__PLUMED_WRAPPER_REINTERPRET_CAST(void **,&func)=tmpptr; \
__PLUMED_WRAPPER_SEARCHF_CAST(func,tmpptr); \
if(debug) __PLUMED_FPRINTF(stderr,"+++ %s found at %p +++\n",name,tmpptr); \
} else { \
if(debug) __PLUMED_FPRINTF(stderr,"+++ Function %s not found\n",name); \
Expand Down

0 comments on commit dc43934

Please sign in to comment.