curl_easy_init.3 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.haxx.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .TH curl_easy_init 3 "4 March 2002" "libcurl 7.8.1" "libcurl Manual"
  23. .SH NAME
  24. curl_easy_init - Start a libcurl easy session
  25. .SH SYNOPSIS
  26. .B #include <curl/curl.h>
  27. .BI "CURL *curl_easy_init( );"
  28. .SH DESCRIPTION
  29. This function must be the first function to call, and it returns a CURL easy
  30. handle that you must use as input to other functions in the easy
  31. interface. This call \fBMUST\fP have a corresponding call to
  32. \fIcurl_easy_cleanup(3)\fP when the operation is complete.
  33. If you did not already call \fIcurl_global_init(3)\fP, \fIcurl_easy_init(3)\fP
  34. does it automatically. This may be lethal in multi-threaded cases, since
  35. \fIcurl_global_init(3)\fP is not thread-safe, and it may result in resource
  36. problems because there is no corresponding cleanup.
  37. You are strongly advised to not allow this automatic behaviour, by calling
  38. \fIcurl_global_init(3)\fP yourself properly. See the description in
  39. \fBlibcurl\fP(3) of global environment requirements for details of how to use
  40. this function.
  41. .SH RETURN VALUE
  42. If this function returns NULL, something went wrong and you cannot use the
  43. other curl functions.
  44. .SH EXAMPLE
  45. .nf
  46. CURL *curl = curl_easy_init();
  47. if(curl) {
  48. CURLcode res;
  49. curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  50. res = curl_easy_perform(curl);
  51. curl_easy_cleanup(curl);
  52. }
  53. .fi
  54. .SH "SEE ALSO"
  55. .BR curl_easy_cleanup "(3), " curl_global_init "(3), " curl_easy_reset "(3), "
  56. .BR curl_easy_perform "(3) "