Current File : //usr/share/doc/libcurl/html/curl_global_init_mem.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<title>curl_global_init_mem man page</title>
<meta name="generator" content="roffit">
<STYLE type="text/css">
pre {
  overflow: auto;
  margin: 0;
}

P.level0, pre.level0 {
 padding-left: 2em;
}

P.level1, pre.level1 {
 padding-left: 4em;
}

P.level2, pre.level2 {
 padding-left: 6em;
}

span.emphasis {
 font-style: italic;
}

span.bold {
 font-weight: bold;
}

span.manpage {
 font-weight: bold;
}

h2.nroffsh {
 background-color: #e0e0e0;
}

span.nroffip {
 font-weight: bold;
 font-size: 120%;
 font-family: monospace;
}

p.roffit {
 text-align: center;
 font-size: 80%;
}
</STYLE>
</head><body>

<p class="level0"><a name="NAME"></a><h2 class="nroffsh">NAME</h2>
<p class="level0">curl_global_init_mem - Global libcurl initialisation with memory callbacks <a name="SYNOPSIS"></a><h2 class="nroffsh">SYNOPSIS</h2>
<p class="level0"><span Class="bold">#include &lt;curl/curl.h&gt;</span> <pre class="level0">
<span Class="bold">CURLcode curl_global_init_mem(long  flags,</span> 
<span Class="bold"> curl_malloc_callback m,</span> 
<span Class="bold"> curl_free_callback f,</span> 
<span Class="bold"> curl_realloc_callback r,</span> 
<span Class="bold"> curl_strdup_callback s,</span> 
<span Class="bold"> curl_calloc_callback c );</span> 
</pre>
<a name="DESCRIPTION"></a><h2 class="nroffsh">DESCRIPTION</h2>
<p class="level0">This function works exactly as <a Class="emphasis" href="./curl_global_init.html">curl_global_init</a> with one addition: it allows the application to set callbacks to replace the otherwise used internal memory functions. 
<p class="level0">If you are using libcurl from multiple threads or libcurl was built with the threaded resolver option then the 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. 
<p class="level0">All callback arguments must be set to valid function pointers. The prototypes for the given callbacks must match these: 
<p class="level0"><a name="void"></a><span class="nroffip">void *malloc_callback(size_t size);</span> 
<p class="level1">To replace malloc() 
<p class="level0"><a name="void"></a><span class="nroffip">void free_callback(void *ptr);</span> 
<p class="level1">To replace free() 
<p class="level0"><a name="void"></a><span class="nroffip">void *realloc_callback(void *ptr, size_t size);</span> 
<p class="level1">To replace realloc() 
<p class="level0"><a name="char"></a><span class="nroffip">char *strdup_callback(const char *str);</span> 
<p class="level1">To replace strdup() 
<p class="level0"><a name="void"></a><span class="nroffip">void *calloc_callback(size_t nmemb, size_t size);</span> 
<p class="level1">To replace calloc() 
<p class="level0">This function is otherwise the same as <a Class="emphasis" href="./curl_global_init.html">curl_global_init</a>, please refer to that man page for documentation. <a name="CAUTION"></a><h2 class="nroffsh">CAUTION</h2>
<p class="level0">Manipulating these gives considerable powers to the application to severely screw things up for libcurl. Take care! <a name="SEE"></a><h2 class="nroffsh">SEE ALSO</h2>
<p class="level0"><a Class="manpage" href="./curl_global_init.html">curl_global_init</a>, <a Class="manpage" href="./curl_global_cleanup.html">curl_global_cleanup</a>
<p class="level0"><p class="roffit">
 This HTML page was made with <a href="http://daniel.haxx.se/projects/roffit/">roffit</a>.
</body></html>