curl\_share\_setopt(3) Library Functions Manual curl\_share\_setopt(3)

# [NAME](#NAME)

curl\_share\_setopt - set options for a shared object

# [SYNOPSIS](#SYNOPSIS)

```
#include <curl/curl.h>
CURLSHcode curl_share_setopt(CURLSH *share, CURLSHoption option, parameter);
```

# [DESCRIPTION](#DESCRIPTION)

Set the *option* to *parameter* for the given *share*.

# [OPTIONS](#OPTIONS)

[CURLSHOPT\_LOCKFUNC](#CURLSHOPT_LOCKFUNC)

See [*CURLSHOPT\_LOCKFUNC(3)*](/man/os/curl/CURLSHOPT_LOCKFUNC.3).

[CURLSHOPT\_UNLOCKFUNC](#CURLSHOPT_UNLOCKFUNC)

See [*CURLSHOPT\_UNLOCKFUNC(3)*](/man/os/curl/CURLSHOPT_UNLOCKFUNC.3).

[CURLSHOPT\_SHARE](#CURLSHOPT_SHARE)

See [*CURLSHOPT\_SHARE(3)*](/man/os/curl/CURLSHOPT_SHARE.3).

[CURLSHOPT\_UNSHARE](#CURLSHOPT_UNSHARE)

See [*CURLSHOPT\_UNSHARE(3)*](/man/os/curl/CURLSHOPT_UNSHARE.3).

[CURLSHOPT\_USERDATA](#CURLSHOPT_USERDATA)

See [*CURLSHOPT\_USERDATA(3)*](/man/os/curl/CURLSHOPT_USERDATA.3).

# [PROTOCOLS](#PROTOCOLS)

This functionality affects all supported protocols

# [EXAMPLE](#EXAMPLE)

```
int main(void)
{


  CURLSHcode sh;


  CURLSH *share = curl_share_init();


  sh = curl_share_setopt(share, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT);


  if(sh)


    printf("Error: %s\n", curl_share_strerror(sh));
}
```

# [AVAILABILITY](#AVAILABILITY)

Added in curl 7.10

# [RETURN VALUE](#RETURN_VALUE)

CURLSHE\_OK (zero) means that the option was set properly, non-zero means an error occurred as \*&lt;curl/curl.h&gt;* defines. See the [*libcurl-errors(3)*](/man/os/curl/libcurl-errors.3) man page for the full list with descriptions.

# [SEE ALSO](#SEE_ALSO)

[**curl\_share\_cleanup**(3)](/man/os/curl/curl_share_cleanup.3), [**curl\_share\_init**(3)](/man/os/curl/curl_share_init.3)

2026-10-19 libcurl

---

Document: curl_share_setopt(3) from curl 8.23.0-r1 (Chainguard OS)
Source: https://github.com/curl/curl.git
