curl_share_init.3 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. .\" generated by cd2nroff 0.1 from curl_share_init.md
  2. .TH curl_share_init 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_share_init \- create a share object
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLSH *curl_share_init();
  9. .fi
  10. .SH DESCRIPTION
  11. This function returns a pointer to a \fICURLSH\fP handle to be used as input
  12. to all the other share\-functions, sometimes referred to as a share handle in
  13. some places in the documentation. This init call MUST have a corresponding
  14. call to \fIcurl_share_cleanup(3)\fP when all operations using the share are
  15. complete.
  16. This \fIshare handle\fP is what you pass to curl using the
  17. \fICURLOPT_SHARE(3)\fP option with \fIcurl_easy_setopt(3)\fP, to make that
  18. specific curl handle use the data in this share.
  19. .SH PROTOCOLS
  20. This functionality affects all supported protocols
  21. .SH EXAMPLE
  22. .nf
  23. int main(void)
  24. {
  25. CURLSHcode sh;
  26. CURLSH *share = curl_share_init();
  27. sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);
  28. if(sh)
  29. printf("Error: %s\\n", curl_share_strerror(sh));
  30. }
  31. .fi
  32. .SH AVAILABILITY
  33. Added in curl 7.10
  34. .SH RETURN VALUE
  35. If this function returns NULL, something went wrong (out of memory, etc.)
  36. and therefore the share object was not created.
  37. .SH SEE ALSO
  38. .BR curl_share_cleanup (3),
  39. .BR curl_share_setopt (3)