gnurl_global_init_mem(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

✨ NAME ✨

gnurl_global_init_mem β€” from the libgnurl Manual β€” is literally the curl_global_init_mem moment: Global libcurl initialisation with memory callbacks. πŸ’…

πŸ“œ SYNOPSIS πŸ“œ

#include <gnurl/curl.h>
CURLcode curl_global_init_mem(long  flags,
 curl_malloc_callback  m,
 curl_free_callback  f,
 curl_realloc_callback  r,
 curl_strdup_callback  s,
 curl_calloc_callback  c );

🧠 DESCRIPTION 🧠

okay so this function works exactly like curl_global_init(3) with one extra little slay: it lets the application set callbacks to replace the internal memory functions that would otherwise be used. 🫢

If you’re using libcurl from multiple threads, or libcurl was built with the threaded resolver option, then those callback functions must be thread safe. The threaded resolver is a common build option to enable (and in some cases the default), so we strongly urge you to make your callback functions thread safe. no cap.

All callback arguments must be set to valid function pointers. The prototypes for the given callbacks must match these:

  • void *malloc_callback(size_t size); β€” to replace malloc()
  • void free_callback(void *ptr); β€” to replace free()
  • void *realloc_callback(void *ptr, size_t size); β€” to replace realloc()
  • char *strdup_callback(const char *str); β€” to replace strdup()
  • void *calloc_callback(size_t nmemb, size_t size); β€” to replace calloc()

This function is otherwise the same as curl_global_init(3), please refer to that man page for documentation. πŸ’–

⚠️ CAUTION ⚠️

Manipulating these gives considerable powers to the application to severely screw things up for libcurl. Take care! πŸ’€

πŸ¦‹ AVAILABILITY πŸ¦‹

Added in 7.12.0 ✨

πŸ‘€ SEE ALSO πŸ‘€

curl_global_init(3), curl_global_cleanup(3)


okay bye bestie β€” this footer is giving libcurl 7.12.0 and 10 May 2004, page gnurl_global_init_mem(3) πŸ’–βœ¨

πŸ“¦ where this page comes from