cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Libcurl, WinApi and progress bar

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 22 Feb 2007 14:31:01 +0100 (CET)

On Thu, 22 Feb 2007, Borucik wrote:

> curl_easy_setopt(context, CURLOPT_PROGRESSFUNCTION,
> &file_receiver::show_progress);
> curl_easy_setopt(context, CURLOPT_PROGRESSDATA, IDC_PROGRESS1);
>
> My function show_progress is a member of a file_receiver class, it looks
> like this:
>
> int file_receiver::show_progress(UINT ID_PROGRESS, double dltotal, double
> dlnow, double utotal, double ulnow){

That won't work, as libcurl is plain C so you need to make the callback an
extern C or at least to be a static function as there will be no 'this'
pointer when libcurl calls the callback.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-02-22