cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Where to call curl_global_cleanup in a UNIX shared library?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 4 Dec 2001 10:10:50 +0100 (MET)

On Mon, 3 Dec 2001, Miklos Nemeth wrote:

> Because I cannot control the behaviour of the scripting engine, I decided
> to call curl_global_cleanup at the end of each request. I do not call
> curl_global_init explicitly because I've learned that curl_global_init is
> called automatically by curl_easy_init.

It is. I don't want to recommend to rely on that behavior though, as it is
mainly implemented to make older programs survive and handle the transition
to the newer API.

> This way each request against my library triggers an global
> initialization and cleanup. I've been testing my apps on Win32 and Linux
> and this procedure seems to be working.
>
> Any comments?

It seems like a waste. You can never take advantage of persistant
connections, cached session IDs or future improvments like cached name
lookups etc. You spend a lot of extra time and resources on nothing.

But it'll work.

> BTW, cURL is terrific.

Thanks! That's really because of all the people that provide feedback,
improvments and advice.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-12-04