On Mon, Dec 15, 2014 at 3:34 AM, Gisle Vanem <[email protected]> wrote: > Jeroen Ooms wrote: > >> #define MAKE_OPTION(a) {#a, CURLOPT_##a} >> >> typedef struct { >> char name[40]; >> int val; >> } keyval; >> >> keyval curl_options[] = { >> MAKE_OPTION(MUTE), >> MAKE_OPTION(ACCEPT_ENCODING), >> ... etc >> }; >> >> But currently this fails when calling MAKE_OPTION with an undefined >> symbol. >> Is there any easy way that I can use the LIBCURL_HAS macro or a variant >> such >> that MAKE_OPTION will set (int val) to e.g. null or -9999999 or so, when >> the symbol >> does not exist in the version of libcurl that is being linked? > > > I've not followed this thread, but can't you use some > external tools to create the list. Like: > grep "^ CINIT(" ../include/curl/curl.h | cut -f1 -d, | sed > 's/CINIT(/CURLOPT_/'
I am not sure this is the most elegant way. It would break if a future version of curl.h would use a different macro than CINIT. Also I would prefer a method method that can also be used to list available CURLINFO_ symbols. ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html
