cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: version number helper macros?

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 16 May 2015 02:38:00 -0400

On 5/14/2015 5:37 PM, Daniel Stenberg wrote:
> It would make it possible to check version at run-time like this:
>
> curl_version_info_data *d = curl_version_info(CURLVERSION_NOW);
>
> if(d->version_num >= CURL_VERSION_BITS(7,33,0) ) {
> /* this is libcurl 7.33.0 or later */
> printf("Succcess\n");
> }
>
> ... and for build-time checks like this:
>
> #if CURL_AT_LEAST_VERSION(7,33,0)
> /* this is 7.33.0 or later */
> #endif
>
> Thoughts? Better ideas?
>
>
> [1] =
> http://stackoverflow.com/questions/30233344/how-to-get-and-compare-libcurl-version

I don't have any opinion on the macros but I'm curious about such a
situation as described in the stackoverflow question. He doesn't
strictly need to get the version does he? If you're working with an
option that you know may not be recognized by the shared library and you
know roughly what you version you have at build time (I assume this
based on the way he asked, but it's unclear) couldn't you just test
against unknown option like:
fallback = (curl_easy_setopt(curl, CURLOPT_XOAUTH2_BEARER, token) ==
CURLE_UNKNOWN_OPTION);

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-05-16