Pirks Pirks - 6 months ago 28
Linux Question

How to store a version number in a static library?

How can I store a version number in a static library (file.a) and later check for its version in Linux?

P.S. I need possibility to check version of file any time without any special executable using only by shell utilities.

Answer

Maybe you could create a string with the version like this:

char* library_version = { "Version: 1.3.6" };

and to be able to check it from the shell just use:

strings library.a | grep Version | cut -d " " -f 2