curl-library
Re: Progress
Date: Wed, 21 Feb 2001 08:16:31 +0100 (MET)
On Wed, 21 Feb 2001 pit_at_paradise.net.nz wrote:
> I's my first time to use threading with Boralnd C++. So i guess i messed
> up at some where.
This smells like it could be a C vs C++ problem.
> For instance i don't know how to implement write_data function which is
> used for CURLOPT_WRITEFUNCTION.
It should be a C-function. You can't make the callback function be a C++
function, as C++ functions expect an extra (hidden) argument that libcurl
won't pass them.
> At the moment i put is as following
>
> //----------------------------------------------------------------
> extern size_t write_data(void *ptr, size_t size, size_t nmemb, FILE
> *stream);
>
> //----------------------------------------------------------------
> void __fastcall TTransferThread::Execute()
> {
> ...
> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
> ...
> }
If figure you actually implement write_data somewhere as well. Ok, my guess
would be to simply make it:
extern "C" {
size_t write_data(void *ptr, size_t size, size_t nmemb,
FILE *stream)
{
/* do what you want with the data */
}
}
> I know that i shouldn't put this kind of topic in here but i don't know
> any where else to ask.
Someone that has experienced libcurl programming from C++ could probably
write down a few hints to think about...
-- Daniel Stenberg -- curl project maintainer -- http://curl.haxx.se/ _______________________________________________ Curl-library mailing list Curl-library_at_lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/curl-libraryReceived on 2001-02-21