#include <curl/curl.h>

CURLcode curl_global_init(long flags );


flags Flags that initialize the program environment that libcurl needs.

Return Values

If this function returns nonzero, something is incorrect and the other curl functions cannot be used.


This function sets up the program environment that libcurl needs. Similar to an extension of the library loader.

This function must be called at least once within a program (a program is all the code that shares a memory space) before the program calls any other function in libcurl. The environment it sets up is constant for the life of the program and is the same for every program, so multiple calls have the same effect as one call.

The flags option is a bit pattern that tells libcurl exactly what features to init, as described below. Set the desired bits by OR'ing the values together. In normal operation, specify CURL_GLOBAL_ALL. Do not use any other value unless familiar with the value and have an intention to control internal operations of libcurl.

This function is not thread-safe. Do not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This does not indicate no other thread that is using libcurl. Because curl_global_init calls functions of other libraries that are similarly not thread-safe, it could conflict with any other thread that uses these other libraries.

For information on how to use this function, see the description of global environment requirements in libcurl.



Initialize everything possible. This sets all known bits.

Do Not Call From


See Also

HTTP Client Library (libcurl)
libcurl API Functions
libcurl Error Codes

Revision History

2013/09/18 Conversion
2013/05/08 Automated cleanup pass.
2012/05/04 Initial version.