How can I print the version of libssl and libnspr in c++ code ? I want to print version for both define开发者_运维问答d in header and library .
The header file opensslv.h #define 's the macro variable OPENSSL_VERSION_TEXT, describing the version. For instance "OpenSSL 0.9.8o-fips 01 Jun 2010".
For the library itself, the name of the lib file contains the version number. In ubuntu, in the folder /lib/, the file is called libssl.so.0.9.8. If you felt like it, you could use boost::filesystem to grab the particular filename and then parse it, perhaps using boost::regex.
精彩评论