cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEFUNC: parameter mess.

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 30 Jan 2006 13:51:30 +0100 (CET)

On Mon, 30 Jan 2006, Michael Kolmodin wrote:

> size_t debugWriteFunc(void* ptr, size_t size, size_t nmemb, void* userp)
>
> The parameters I get when libcurl calls my function are:
>
> ptr: 01
> size: 1266
> nmemb: 5275840
> userp 111

So it looks like they're shifted one "step"...

> My test program is C++, but I'm using the C bindings. Specifically, the
> function called is just a library function, not a class method. The overall
> setup "seems" OK, I've managed to setup, send a message and get the response
> from the server. But not to store the response.

Could it be that this is a common C++ method (as opposed to a static one or
one made within a extern "C" {} thing) and thus you get a "hidden" 'this'
pointer that eats the first pointer libcurl passes on (the ptr) and then the
rest of the arguments get shifted this way?

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2006-01-30