1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: curl_share_init 5Section: 3 6Source: libcurl 7See-also: 8 - curl_share_cleanup (3) 9 - curl_share_setopt (3) 10Protocol: 11 - All 12--- 13 14# NAME 15 16curl_share_init - Create a shared object 17 18# SYNOPSIS 19 20~~~c 21#include <curl/curl.h> 22 23CURLSH *curl_share_init(); 24~~~ 25 26# DESCRIPTION 27 28This function returns a pointer to a *CURLSH* handle to be used as input 29to all the other share-functions, sometimes referred to as a share handle in 30some places in the documentation. This init call MUST have a corresponding 31call to curl_share_cleanup(3) when all operations using the share are 32complete. 33 34This *share handle* is what you pass to curl using the 35CURLOPT_SHARE(3) option with curl_easy_setopt(3), to make that 36specific curl handle use the data in this share. 37 38# EXAMPLE 39 40~~~c 41int main(void) 42{ 43 CURLSHcode sh; 44 CURLSH *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} 49~~~ 50 51# AVAILABILITY 52 53Added in 7.10 54 55# RETURN VALUE 56 57If this function returns NULL, something went wrong (out of memory, etc.) 58and therefore the share object was not created. 59