jsoncpp icon indicating copy to clipboard operation
jsoncpp copied to clipboard

runtime function giving the version (as a string)

Open bstarynk opened this issue 3 years ago • 1 comments

Runtime description of the version of the library I am using JsonCPP in a program (like RefPerSys) following GNU conventions on Linux. When running as ./refpersys --version that program gives the version of all relevant runtime libraries.

Describe the solution you'd like Some extern "C" const char* jsoncpp_give_runtime_version(void); function returning the runtime semantic version of the library.

Describe alternatives you've considered Using macros like JSONCPP_VERSION_STRING is less accurate. It gives the version at compile time of my refpersys executable, and with dynamic linking the runtime library version could have evolved.

Thanks for JSONCPP Please ask any more details to me (Basile Starynkevitch, in France) by email to [email protected] (office, at CEA LIST) or [email protected] (home, near Paris, France)

bstarynk avatar Feb 07 '23 18:02 bstarynk

Implementation is easy (at least on Linux). Add the following code somewhere:

const char*
jsoncpp_give_runtime_version(void) {
   return JSONCPP_VERSION_STRING;
}

When the runtime library has evolved in a minor way (e.g. a shared library updated by some Debian package), the result would change at runtime, without needing recompilation of the calling program (like RefPerSys...)

bstarynk avatar Feb 07 '23 18:02 bstarynk