curl-library
Introducing CURL_HAS() ?
Date: Thu, 3 Sep 2015 11:35:30 +0200 (CEST)
Hi friends!
I'm interested in your feedback and thoughts on this suggestion. See attached
patch.
This introduces a new header file that gets generated at build-time (only the
autotools build is adapted yet). It introduces a macro call CURL_HAS() that
can be used by applications to check if symbols are present in their version
of libcurl
An application could check for any public CURL_* symbol like this:
#if CURL_HAS(CURL_SOCKOPT_ERROR)
... and that would only evaluate true when compiled against curl headers from
a libcurl version that provides that symbol.
It also offers a variation of the macro if you for any reason want to check a
specific version. Did the option exist in 7.10.0 ?
#if CURL_HAS_IN(CURL_SOCKOPT_ERROR, 0x70a00)
Of course it'll be an issue for application authors that this macro is only
present from now on in an official curl but at least it can easily be copied
into and used with an older version if you want to. And if we introduce it
now, it'll still be a viable option in the future...
I'm of course also interested in bikeshedding opinions like how to name it,
how to use the macro and things like that.
-- / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- TEXT/X-DIFF attachment: 0001-has-generate-the-curl-has.h-header.patch