cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: segfaulting in Curl_num_addresses on OS X and Ubuntu

From: Ray Satiro via curl-library <curl-library_at_cool.haxx.se>
Date: Sat, 1 Aug 2015 04:03:39 -0400

On 7/31/2015 10:44 PM, Eric Ridge wrote:
>> On Jul 31, 2015, at 9:41 PM, Ray Satiro via curl-library <curl-library_at_cool.haxx.se> wrote:
>>
>> Would you find this easier to understand:
>>
>> *If you are using libcurl from multiple threads or libcurl was built with the threaded resolver option (the default in Windows) then the callback replacement functions must be thread safe.*
> Is there a way to programmatically know if the version being used was compiled with the threaded resolver?

Yes. I wrote an example [1] that will output whether libcurl's resolver
is synchronous, c-ares or threaded.

> If not maybe say:
>
> "The callback replacement functions must be thread safe, even if your application is single-threaded; libcurl may create threads at its own discretion (ie, via the threaded resolver)."

That's not accurate though. The callback functions don't need to be
thread safe unless the user is using libcurl with multiple threads or
libcurl was built with the threaded resolver. That's why I think this
would be better:

*If you are using libcurl from multiple threads or libcurl was built
with the threaded resolver option (the default in Windows) then the
callback replacement functions must be thread safe.*

Let's wait a few days and see if anyone else has an opinion.

> <topic change>
>
> Let me ask... for projects that link to libcurl (as opposed to exec-ing the command-line interface), do you find that they try to work with the OS-installed version (ie, dynamically link), or do they include a particular version of libcurl and statically link?
>
> For my little open-source project, I'm trying to decide what's actually best for me. The advantage of dynamically linking is ease of installation for users, but then I have to support much older versions of libcurl, so it makes me wonder if I should statically link. The "thread safety" issues I've had are clearly my fault, but trying to support CentOS/Ubuntu/OSX versions that a) are compiled with different runtime-affecting features, and b) are drastically different versions, makes me sad. The distro problem is not one y'all can control, but I'm just curious what you've seen as the pattern in the world...

I'm mostly in Windows but FWIW the projects I've worked have mostly
built and used the DLL. In Windows a lot of software comes with DLLs
that are put in the software's program folder and exclusively for that
software or family. One reason for that might be it allows updating a
module rather than the entire software, which I've done. Generally
speaking package managers don't seem to be very common and software
handles updates on its own.

[1]: https://gist.github.com/jay/d3323a81345e75462b70

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