CURLMOPT_NOTIFYDATA(3)

πŸ’… CURLMOPT_NOTIFYDATA(3) πŸ’…

ok so bestie, welcome to the Library Functions Manual β€” this one's a short one, but it's lowkey iconic. let's get into it ✨


🌸 NAME 🌸

CURLMOPT_NOTIFYDATA β€” the custom pointer you hand off to your notification callback. that's it. that's the vibe 🫢


✨ SYNOPSIS ✨

#include <curl/curl.h>

CURLMcode curl_multi_setopt(CURLM *handle, CURLMOPT_NOTIFYDATA, void *pointer);

like, one function call, one void *, no drama πŸ’…


πŸ’– DESCRIPTION πŸ’–

so this is a data pointer that gets passed along to the notification callback β€” the one you set up with the CURLMOPT_NOTIFYFUNCTION(3) option. think of it as slipping your bestie a little note that says "hey, this is mine, use it" πŸŽ€

and listen β€” libcurl does not touch this pointer. like, at all. no peeking, no modifying, no main-character interference. it's literally just handed straight in as the notification callback's clientp argument. that's the whole job. iconic behavior honestly πŸ‘‘


πŸ¦‹ DEFAULT πŸ¦‹

NULL

(yeah, it starts out empty β€” no pointer, no problem 🌈)


🌼 PROTOCOLS 🌼

this functionality affects all supported protocols β€” every single one, fr fr πŸ’œ


⭐ EXAMPLE ⭐

ok here's the whole thing in action, copy it, love it, run it:

struct priv {
  void *ours;
};

static void notify_cb(CURLM *multi, unsigned int notification,
                      CURL *easy, void *notifyp)
{
  struct priv *p = notifyp;
  printf("my ptr: %p\n", p->ours);
  /* ... */
}

int main(void)
{
  struct priv setup;
  CURLM *multi = curl_multi_init();
  /* ... use socket callback and custom pointer */
  curl_multi_setopt(multi, CURLMOPT_NOTIFYFUNCTION, notify_cb);
  curl_multi_setopt(multi, CURLMOPT_NOTIFYDATA, &setup);
  curl_multi_notify_enable(multi, CURLMNOTIFY_INFO_READ);
}

see how &setup just slides right into notifyp? chef's kiss 🧚 no cap, that's the whole flow.


πŸŽ€ AVAILABILITY πŸŽ€

added in curl 8.17.0 β€” so if your curl is older than that, bestie, it's giving "not yet" 😭 go update πŸ’€


πŸ‘‘ RETURN VALUE πŸ‘‘

returns CURLM_OK. that's it. slay, no error codes to stress about πŸ’–


πŸ’œ SEE ALSO πŸ’œ

go read those next, iykyk πŸ“š


and that's the page, bestie 🫢 brought to you by libcurl, dated 2026-10-25 β€” mwah, go forth and notify πŸ’…βœ¨

πŸ“¦ where this page comes from