[
https://issues.apache.org/jira/browse/ZOOKEEPER-4556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kezhu Wang updated ZOOKEEPER-4556:
----------------------------------
Fix Version/s: 3.10.0
> Add zoo_version_str to return ZOO_VERSION for runtime library
> -------------------------------------------------------------
>
> 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
> Priority: Major
> Labels: api-addition, pull-request-available
> Fix For: 3.10.0
>
> Original Estimate: 2h
> Time Spent: 50m
> Remaining Estimate: 1h 10m
>
> A function zoo_version_str would be useful for the same reasons that
> librdkafka has a rd_kafka_version_str, 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 as a patch to
> 3.5 and earlier.
> {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.
> The implementation for the master branch and 3.6 and later is
> {code:java}
> const char *zoo_version_str() {
> return ZOO_VERSION;
> }{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)