W dniu 2022-09-22 15:57, Daniel Stenberg napisaĆ(a):
On Thu, 22 Sep 2022, Daniel F via curl-library wrote:
You can consider another approach for this - add new global function
curl_global_setopt. It would better fit how libcurl works now. This
new function should be called after
curl_global_init/curl_global_init_mem and before any other libcurl
calls.
In theory, yes. We have however rather tried to decrease the use of
globals over time since they make things complicated in multi-threaded
situations.
Yes, this can cause problems. One way to address this is to document it
somewhere, unfortunately people still would be able to write bad code
and complain here that something does not work. So better approach would
be to pass all these global options to curl_global_init_opts function:
struct CURL_INIT_OPTIONS curl_opts;
memset(&curl_opts, 0, sizeof(curl_opts));
curl_opts.flags = CURL_GLOBAL_DEFAULT;
curl_opts.foo = ...;
curl_opts.bar = ...;
curl_global_init_opts(&curl_opts, sizeof(curl_opts));
2nd parameter for curl_global_init_opts is added for forward
compatibility, so libcurl could check if structure passed by application
contains given field. Such approach is common is Windows API.
--
Regards,
Daniel
--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette: https://curl.se/mail/etiquette.html