cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_WRITEFUNCTION

From: Jeff Phillips <jeff_at_jeffp.net>
Date: Wed, 4 May 2005 11:41:01 -0700 (PDT)

Cris,

Implement WriteMemoryCallback (with the correct
signature of course) as a static member, NOT an
instance member. Then modify the call to
curl_easy_setopt, as follows:

curl_easy_setopt(curl_handle,
    CURLOPT_WRITEFUNCTION,
    MyClass::WriteMemoryCallback);

Take care,
Jeff Phillips

--- Cris D Putnam <cdputnam_at_us.ibm.com> wrote:

> I am trying to put the HTML code into memory in a
> C++ class. I am copying
> the general idea of getinmemory.c . But my program
> crashes with this
> error:
>
> Run-Time Check Failure #0 - The value of ESP was not
> properly saved across
> a function call. This is usually a result of calling
> a function declared
> with one calling convention with a function pointer
> declared with a
> different calling convention.
>
> On these line of code:
> / send all data to this function
> curl_easy_setopt(curl_handle,
> CURLOPT_WRITEFUNCTION,
> WriteMemoryCallback);
>
>
> When called alone this->WriteMemoryCallback does not
> crash the program...
> So I have narrowed it down to
> CURLOPT_WRITEFUNCTION
> This line is just fine in a main mehod, but when I
> put it within a
> function of a .cpp class I guess the calling
> convention is different? How
> can I fix this?
>
> Thank You
>
> Cris D. Putnam
>
Received on 2005-05-04