> I'm not calling curl_global_init()/curl_global_cleanup() more than
> once. I'm calling them only once. Xerces is a 3rd party library and
> I have no access to the source or know how they are using curl in
> the their library. This is a large C++ application and I'm using
> curl in only one class. In my ctor, I call curl_global_init() first
> then make a call to curl_easy_init(). According to the curl
> documentation, if you call curl_global_init(), you should call
> curl_global_cleanup(). Likewise it says if you call
> curl_easy_init(), then you should call curl_easy_cleanup(), but when
> I do this the application crashes with a SIGSEGV, Segmentation fault.
You may want to have a close look at CurlNetAccessor in the Xerces
library. That class controls the initialization of libcurl within
xerces and contains a subtle warning:
//
// Global once-only init and cleanup of curl
//
// The init count used here is not thread protected; we assume
// that creation of the CurlNetAccessor will be serialized by
// the application. If the application is also using curl, then
// care must be taken that curl is initialized only once, by some
// other means, or by overloading these methods.
//
One thing you can try to do is adding a CurlNetAccessor member
variable to your class that takes care of the initialization of
libcurl in your app and xerces. In addition remove the calls to
curl_global_init and curl_global_cleanup from ctor and dtor.
- Joost
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-11-25