cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcURL application failed to initialize properly

From: Ben Noordhuis <info_at_bnoordhuis.nl>
Date: Tue, 26 Apr 2011 23:38:57 +0200

On Tue, Apr 26, 2011 at 23:25, mammar <mammar_at_gmail.com> wrote:
> #include <stdio.h>
> #include <curl.h>
>
> int main(void)
> {
>   CURL *curl;
>   CURLcode res;
>
>   curl = curl_easy_init();
>   if(curl) {
>     curl_easy_setopt(curl, CURLOPT_URL, "www.linux.com");
>     res = curl_easy_perform(curl);
>
>     /* always cleanup */
>     curl_easy_cleanup(curl);
>   }
>   return 0;
> }

mammar, you must call curl_global_init() before any other libcurl
function - and tear down with curl_global_cleanup(), either explicitly
or through atexit().

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-04-26