cURL / Mailing Lists / curl-library / Single Mail

curl-library

[Fwd: Re: [cURLpp] cURLpp::Cleanup]

From: Jean-Philippe Barrette-LaPierre <jpb_at_rrette.com>
Date: Wed, 25 Jan 2006 08:32:04 -0500

I just fowarded your email to the curl-library mailing-list. Your
question is more libcURL related. Sorry Daniel to foward this mail to
the libcURL mailing list, I know the code is done with cURLpp, but I
don't know the answer. Thanks you.

P.S.: From now on, how do you want me to handle this kind of question?

attached mail follows:


Le Janvier 23, 2006 06:33 PM, John Burnette a écrit :
> Hi,
>
> I just started using cURLpp and so far it has been wonderful.  I was
> looking through the sample programs and came across the line:
>
> cURLpp::Cleanup myCleanup
>
> in all of the apps.  What exactly does this do or what does it clean up?
> Does it delete my handle?  Where does this go in my code if I plan to reuse
> the same handle during the lifetime of my program?

cURLpp::Cleanup is just an utility class that does cURLpp::initialize() within
the constructor and cURLpp::terminate() within the destructor. It's nice to
use if you know the cURLpp's lifetime within your application, but you can
just call the initialize function and the terminate function when you need
to. You should take a look at curl_easy_init's and curl_easy_cleanup's doc.

Here's the doc of cURLpp::initialize:

   /**
    * This function takes care of initializing cURLpp ( also libcURL).
    * If you want to cleanup cURL before your application quits just
    * call cURLpp::terminate(). This function should only be called
    * once (no matter how many threads or libcurl sessions that'll
    * be used) by every application that uses libcurl, it will throw a
    * logic_error if you call it twice.
    *
    * NOTE: you cannot call this function twice without first
    * terminating it first. it will throw a logic_error if you do this.
    */

-- 
Jean-Philippe Barrette-LaPierre
Savoir-Faire Linux
(514) 276-5468 #251
_______________________________________________
cURLpp mailing list
cURLpp_at_rrette.com
http://www.rrette.com/mailman/listinfo/curlpp
Received on 2006-01-25