This question related to accepted answer to this question. The answer states that you can add the version as a char somewhere in the library code.
char* library_version = { "Version: 1.3.6" };
If I was following the approach for an executable, I would just place this somewhere in the beginning of main. Where should it be placed in a library to be sure it will be executed?