cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Stupid question about callbacks

From: Andy hobbs <andy_at_trogs.org.uk>
Date: Tue, 24 Aug 2004 12:23:26 +0000

Hi,

You create a callback function and register it.

In your call back you handle memory allocation and the handle the
deallocation as and when you see fit

Hope that helps

Andy

On Tue, 2004-08-24 at 12:09, Brian Akins wrote:
> This is more a libcurl user question, but:
>
> In a callback such as:
>
> size_t <http://curl.haxx.se/lxr/ident?i=size_t>
> WriteMemoryCallback <http://curl.haxx.se/lxr/ident?i=WriteMemoryCallback>(void *ptr, size_t <http://curl.haxx.se/lxr/ident?i=size_t> size <http://curl.haxx.se/lxr/ident?i=size>, size_t <http://curl.haxx.se/lxr/ident?i=size_t> nmemb, void *data <http://curl.haxx.se/lxr/ident?i=data>)
>
>
> Who "owns" the memory pointed to by ptr, the callback or the
> curl_handle? Does the callback need to free it or does it always need
> to memcpy it.
>
>
> Stupid question, I know, but I don't think I've found this documented
> anywhere.

-- 
Andy hobbs <andy_at_trogs.org.uk>
Received on 2004-08-24