curl_share_init.3 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 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.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. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .TH curl_share_init 3 "Aug 3, 2003" "libcurl" "libcurl"
  25. .SH NAME
  26. curl_share_init - Create a shared object
  27. .SH SYNOPSIS
  28. .nf
  29. #include <curl/curl.h>
  30. CURLSH *curl_share_init();
  31. .fi
  32. .SH DESCRIPTION
  33. This function returns a pointer to a \fICURLSH\fP handle to be used as input
  34. to all the other share-functions, sometimes referred to as a share handle in
  35. some places in the documentation. This init call MUST have a corresponding
  36. call to \fIcurl_share_cleanup(3)\fP when all operations using the share are
  37. complete.
  38. This \fIshare handle\fP is what you pass to curl using the
  39. \fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, to make that
  40. specific curl handle use the data in this share.
  41. .SH EXAMPLE
  42. .nf
  43. CURLSHcode sh;
  44. share = curl_share_init();
  45. sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
  46. if(sh)
  47. printf("Error: %s\\n", curl_share_strerror(sh));
  48. .fi
  49. .SH AVAILABILITY
  50. Added in 7.10
  51. .SH RETURN VALUE
  52. If this function returns NULL, something went wrong (out of memory, etc.)
  53. and therefore the share object was not created.
  54. .SH "SEE ALSO"
  55. .BR curl_share_cleanup "(3), " curl_share_setopt "(3)"