CURLOPT_RESOLVER_START_DATA(3)

✨ CURLOPT_RESOLVER_START_DATA(3) ✨

okay bestie so this is a libcurl manual page, and honestly? it's a tiny one but it's kind of a vibe. it's all about CURLOPT_RESOLVER_START_DATA β€” the little pointer you hand over to your resolver start callback. lowkey iconic that something this small exists. let's get into it 🫢


🌸 NAME 🌸

CURLOPT_RESOLVER_START_DATA β€” pointer passed to the resolver start callback

πŸ’… SYNOPSIS πŸ’…

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESOLVER_START_DATA,
                          void *pointer);

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: you pass in a pointer, and libcurl literally does not touch it. it's untouched. it's sacred. libcurl keeps its hands off and just forwards it straight through as the third argument in the resolver start callback β€” the one you set with CURLOPT_RESOLVER_START_FUNCTION(3). that's it. that's the whole job. you give it a pointer, it hands it back to you later. no cap, that's the deal πŸ’–

πŸŽ€ DEFAULT πŸŽ€

NULL

like, nothing. nada. the void. πŸ•³οΈ

🌈 PROTOCOLS 🌈

this functionality affects all supported protocols β€” every single one, periodt ✨

⭐ EXAMPLE ⭐

here's a whole little program, and honestly the way it just sets everything up and goes? main character energy πŸ”₯

static int resolver_start_cb(void *resolver_state, void *reserved,
                             void *userdata)
{
  (void)reserved;
  printf("Received resolver_state=%p userdata=%p\n",
         resolver_state, userdata);
  return 0;
}

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    curl_easy_setopt(curl, CURLOPT_RESOLVER_START_FUNCTION, resolver_start_cb);
    curl_easy_setopt(curl, CURLOPT_RESOLVER_START_DATA, curl);
    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

see how it sets the data to curl? yup. that's the pointer round-trip in action, bestie πŸ’œ

πŸ‘‘ AVAILABILITY πŸ‘‘

Added in curl 7.59.0 β€” so she's been around a minute, iykyk.

πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error, fr fr.

  • CURLE_OK (0) means everything was OK ✨
  • non-zero means an error occurred β€” go check libcurl-errors(3) to see what went down 😭

🧚 SEE ALSO 🧚


and that's the whole page, bestie πŸŽ€ this was the libcurl manual, dated 2026-10-12, page CURLOPT_RE..._START_DATA(3) β€” go forth and pass your pointers with confidence πŸ’…βœ¨

πŸ“¦ where this page comes from