# curl_global_init

Definition: | include builtins\libcurl.e curl_global_init(integer flags=CURL_GLOBAL_DEFAULT)
Description: | This procedure sets up the program environment that libcurl needs. Think of it as an extension of the library loader. Typically you call curl_global_init() at the start of your program and curl_global_cleanup() at the end.
pwa/p2js: | Not supported.
Comments: | This procedure 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 ORing the values together. In normal operation, specify CURL_GLOBAL_ALL (==CURL_GLOBAL_DEFAULT). Do not use any other value unless you are familiar with it and mean to control internal operations of libcurl. This procedure is not thread safe. You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This doesn’t just mean no other thread that is using libcurl. Because curl_global_init calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries. If you are initializing libcurl from a Windows DLL you should not initialize it from DllMain or a static initializer because Windows holds the loader lock during that time and it could cause a deadlock. See the description in https://curl.haxx.se/libcurl/c/libcurl.html of global environment requirements for details of how to use this routine. The following constants are provided:
    global constant CURL_GLOBAL_SSL       = 1,  -- (deprecated in 7.57.0)
                    CURL_GLOBAL_WIN32     = 2,
                    CURL_GLOBAL_ALL       = or_bits(CURL_GLOBAL_SSL, CURL_GLOBAL_WIN32),
                    CURL_GLOBAL_NOTHING   = 0,
                    CURL_GLOBAL_DEFAULT   = CURL_GLOBAL_ALL,
                    CURL_GLOBAL_ACK_EINTR = 4
Note that CURL_GLOBAL_SSL ceased to have any effect in 7.57.0 A fatal error occurs if initialisation fails.
Example: | Copy
    include builtins\libcurl.e
    curl_global_init()
    ...
    curl_global_cleanup()
See Also: | curl_global_cleanup, curl_easy_init