---
name: "curl_share_setopt"
section: "3"
platform: "macos"
package: "curl"
version: "166.0.0.0.1"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/curl_share_setopt"
---

# curl\_share\_setopt(3)

Set options for a shared object

## NAME

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

## SYNOPSIS

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

## DESCRIPTION

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

## OPTIONS

- CURLSHOPT\_LOCKFUNC

  See *[CURLSHOPT\_LOCKFUNC(3)](/CURLSHOPT_LOCKFUNC/3.md)*.

- CURLSHOPT\_UNLOCKFUNC

  See *[CURLSHOPT\_UNLOCKFUNC(3)](/CURLSHOPT_UNLOCKFUNC/3.md)*.

- CURLSHOPT\_SHARE

  See *[CURLSHOPT\_SHARE(3)](/CURLSHOPT_SHARE/3.md)*.

- CURLSHOPT\_UNSHARE

  See *[CURLSHOPT\_UNSHARE(3)](/CURLSHOPT_UNSHARE/3.md)*.

- CURLSHOPT\_USERDATA

  See *[CURLSHOPT\_USERDATA(3)](/CURLSHOPT_USERDATA/3.md)*.

## 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

Added in 7.10

## RETURN VALUE

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

## SEE ALSO

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