

Specifications
- Product: libcurl
- Function: curl _share _init
- Version: 7.10.7
- Date: 8 Aug 2003
NAME
curl_ share _init – Create a shared object
SYNOPSIS
- #include <curl/curl .h>
- CURLSH *curl _share _init( );
DESCRIPTION
- This function returns a CURLSH handle to be used as input to all the other share-functions, sometimes referred to as a share handle on some places in the documentation. This infit call MUST have a corresponding call to curl_ share_ cleanup when all operations using the share are complete.
- This share handle is what you pass to curl using the CURLOPT_SHARE option with curl _easy _set opt(3), to make that specific curl handle use the data in this share.
RETURN VALUE
- If this function returns NULL, something went wrong (out of memory, etc.) and therefore the share object was not created.
- SEE ALSO curl _share_ cleanup(3), curl _share _setopt(3)
FAQs
Q: What should I do if curl _share _init() returns NULL?
A: If this function returns NULL, it indicates that something went wrong, possibly due to memory issues. In such cases, the share object was not created.
Q: How do I know if I need to use a share handle with libcurl?
A: You need to use a share handle when you want multiple libcurl handles to share data, such as cookies or DNS cache, amongst each other.
Documents / Resources
![]() | Curl_Share_Init - Create A Shared Object |
References
- User Manualmanual.tools
Published: February 25, 2026
Updated: February 28, 2026

