1curl_global_init(3)             libcurl Manual             curl_global_init(3)
2
3
4

NAME

6       curl_global_init - Global libcurl initialisation
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_global_init(long flags);
12

DESCRIPTION

14       This  function  sets  up  the  program  environment that libcurl needs.
15       Think of it as an extension of the library loader.
16
17       This function must be called at least once within a program (a  program
18       is  all  the  code that shares a memory space) before the program calls
19       any other function in libcurl.  The environment it sets up is  constant
20       for  the life of the program and is the same for every program, so mul‐
21       tiple calls have the same effect as one call.
22
23       The flags option is a bit pattern that tells libcurl exactly what  fea‐
24       tures  to  init,  as described below. Set the desired bits by ORing the
25       values   together.    In   normal   operation,   you    must    specify
26       CURL_GLOBAL_ALL.   Don't  use  any  other value unless you are familiar
27       with it and mean to control internal operations of libcurl.
28
29       This function is not thread safe. You must not call it when  any  other
30       thread  in  the program (i.e. a thread sharing the same memory) is run‐
31       ning.  This doesn't just mean no other thread that  is  using  libcurl.
32       Because curl_global_init(3) calls functions of other libraries that are
33       similarly thread unsafe, it could conflict with any other  thread  that
34       uses these other libraries.
35
36       If  you are initializing libcurl from a Windows DLL you should not ini‐
37       tialize it from DllMain or a static initializer because  Windows  holds
38       the loader lock during that time and it could cause a deadlock.
39
40       See  the  description  in libcurl(3) of global environment requirements
41       for details of how to use this function.
42

FLAGS

44       CURL_GLOBAL_ALL
45              Initialize everything possible. This sets all known bits  except
46              CURL_GLOBAL_ACK_EINTR.
47
48
49       CURL_GLOBAL_SSL
50              (This flag's presence or absence serves no meaning since 7.57.0.
51              The description below is for older libcurl versions.)
52
53              Initialize SSL.
54
55              The implication here is that if this bit is not  set,  the  ini‐
56              tialization of the SSL layer needs to be done by the application
57              or at least outside of libcurl. The exact procedure  how  to  do
58              SSL initialization depends on the TLS backend libcurl uses.
59
60              Doing  TLS based transfers without having the TLS layer initial‐
61              ized may lead to unexpected behaviors.
62
63       CURL_GLOBAL_WIN32
64              Initialize the Win32 socket libraries.
65
66              The implication here is that if this bit is not  set,  the  ini‐
67              tialization  of winsock has to be done by the application or you
68              risk getting undefined behaviors. This option  exists  for  when
69              the  initialization  is handled outside of libcurl so there's no
70              need for libcurl to do it again.
71
72       CURL_GLOBAL_NOTHING
73              Initialise nothing extra. This sets no bit.
74
75       CURL_GLOBAL_DEFAULT
76              A sensible default. It will init both SSL and Win32. Right  now,
77              this equals the functionality of the CURL_GLOBAL_ALL mask.
78
79       CURL_GLOBAL_ACK_EINTR
80              This  bit  has no point since 7.69.0 but its behavior is instead
81              the default.
82
83              Before 7.69.0: when this flag  is  set,  curl  will  acknowledge
84              EINTR  condition when connecting or when waiting for data.  Oth‐
85              erwise, curl waits until full timeout elapses. (Added in 7.30.0)
86

RETURN VALUE

88       If this function returns non-zero, something went wrong and you  cannot
89       use the other curl functions.
90

SEE ALSO

92       curl_global_init_mem(3), curl_global_cleanup(3), curl_global_sslset(3),
93       curl_easy_init(3) libcurl(3)
94
95
96
97libcurl 7.79.1                 November 04, 2020           curl_global_init(3)
Impressum