open-source-parsers / jsoncpp

A C++ library for interacting with JSON.
Other
8.06k stars 2.63k forks source link

add a runtime API for version information #1531

Open bstarynk opened 6 months ago

bstarynk commented 6 months ago

Most Linux programs want a --version program option. This is suggested in GNU coding standards.

The jsoncpp library already gives the preprocessor JSONCPP_VERSION_STRING.

It would be useful to add some runtime function giving the same information (since we have a /usr/lib/x86_64-linux-gnu/libjsoncpp.so shared library)

My suggestion would be to add some static member in that shared library

 const char*Json::Features::version() { return JSONCPP_VERSION_STRING; };

This is inspired by similar API in GNU libc, Qt, GTK, .... and enables a program using jsoncpp to display the version information of the runtime linked shared library, or perhaps to check at runtime that the version of the shared library is compatible with what the program expects.

We are using jsoncpp in the RefPerSys open source inference engine project.

Regards from Basile Starynkevitch in France.

BillyDonahue commented 6 months ago

seems like a good idea!

ǝnɥɐuop ʎllıq

On Tue, Feb 27, 2024 at 10:24 Basile Starynkevitch @.***> wrote:

Most Linux programs want a --version program option. This is suggested in GNU coding standards https://www.gnu.org/prep/standards/html_node/index.html .

The jsoncpp library already gives the preprocessor JSONCPP_VERSION_STRING.

It would be useful to add some runtime function giving the same information (since we have a `/usr/lib/x86_64-linux-gnu/libjsoncpp.so shared library)

My suggestion would be to add some static member in that shared library

const char*Json::Features::version() { return JSONCPP_VERSION_STRING; };

This is inspired by similar API in GNU libc, Qt, GTK, .... and enables a program using jsoncpp to display the version information of the runtime linked shared library

— Reply to this email directly, view it on GitHub https://github.com/open-source-parsers/jsoncpp/issues/1531, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACBWORHQG2QFRRXUOXJ6FNTYVWQ47AVCNFSM6AAAAABD3XKJ7GVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2TMMBYG44DKNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>