George J Carrette created ZOOKEEPER-4556: --------------------------------------------
Summary: function zoo_version_str for determining what libzookeeper.so was loaded Key: ZOOKEEPER-4556 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4556 Project: ZooKeeper Issue Type: Improvement Components: c client Affects Versions: 3.8.0 Reporter: George J Carrette Fix For: 3.9.0 A function zoo_version_str would be useful for the same reasons that librdkafka has a rd_kafka_version_st, in short, for when a program has dynamically loaded libzookeeper_mt.so and wants to verify that it provides the expected api version that the calling program was compiled against. It is true that zookeeper-native binary package usually contains the /usr/include/zookeeper files but that is not always the case and even so provides a more complex scanning issue than simply calling an api function. Here is the full source code needed to implement this function. {code:java} #define STR1(x) STR2(x) #define STR2(x) #x const char *zoo_version_str() { return STR1(ZOO_MAJOR_VERSION) "." STR1(ZOO_MINOR_VERSION) "." STR1(ZOO_PATCH_VERSION); } {code} This function would also be used by any language using a libffi style solution, of which there are many. In this case you preprocess the /usr/include/zookeeper files into an application binary interface (ABI) and then at runtime you must ensure that your ABI matches the API version for the dynamic library which you want to consume. -- This message was sent by Atlassian Jira (v8.20.7#820007)