To allow client code rertieve library version instead of hard-coding it somewhere.
Motivation:
- informational purposes / troubleshooting (e. g. about box or log file with detailed list of used libraries)
- validation that code is being compiled with compatible version (e. g. if source is pulled from somewhere)
Can be in form of preprocessor definitions for integral version components (major, minor etc.) or preformatted string, e. g. "3.0.0". For example, SQLite defines these macros:
#define SQLITE_VERSION "3.15.0"
#define SQLITE_VERSION_NUMBER 3015000