cURL / Mailing Lists / curl-library / Single Mail

curl-library

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

From: Miklos Nemeth <mnemeth_at_kfkisystems.com>
Date: Mon, 03 Dec 2001 08:57:34 -0800

Thank you Daniel for your help.

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.
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?

BTW, cURL is terrific.

Miklos

Daniel Stenberg wrote:

> On Fri, 30 Nov 2001, Miklos Nemeth wrote:
>
> > I'm developing a libcurl-based ecommerce library for a scripting
> > engine, and implement my library as a shared object (DLL).
> > It's clear that one can call curl_global_cleanup
> > in the DllMain when the DLL is shut down.
> >
> > Is there similar point in UNIX shared libraries?
>
> No. A shared library in unix is just a set of functions that you load
> dynamicly.
>
> You'll probably have to introduce your own library-init and library-cleanup
> calls for the user of your library to call.
>
> > Is it really mandatory to call curl_global_cleanup?
>
> If your program is gonna exit anyway (and thus free/close all resources), it
> doesn't matter. If your program plans to call curl_global_init() again, you
> better make sure cleanup was called first.
>
> --
> Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-12-03