cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem using c++ functors for CURLOPT_HEADERFUNCTION

From: Jean-Philippe Barrette-LaPierre <jpb_at_rrette.com>
Date: Mon, 28 May 2007 23:05:56 -0400

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 28-May-07, at 8:53 PM, Dan Fandrich wrote:

> On Tue, May 29, 2007 at 01:44:14AM +0200, pepone.onrez wrote:
>> When i set CURLOPT_HEADERFUNCTION to my fuctor i get Segmentation
>> Fault form libcurl in
>>
>> #1 0xb6a7fcff in Curl_client_write () from /usr/lib/libcurl.so.3
>>
>>
>>
>> writeHeaderFunctor = new
>> TSpecificFunctor<WebBrowser>(this,&WebBrowser::writeHeader);
>> curl_easy_setopt(_handle,CURLOPT_HEADERFUNCTION ,writeHeaderFunctor);
>> curl_easy_perform(_handle);
>>
>>
>> I tes my fuctor whith the following code and its work
>> void* ptr,*stream;
>> size_t size,nmemb;
>> (*writeHeaderFunctor)(ptr,size,nmemb,stream);
>>
>> Any ideas because libcurl crash when try call the writeHeaderFunctor
>
> functor != function. libcurl takes a function pointer. Maybe the C+
> + curl
> binding would accept otherwise, but I doubt it.

It does. You're even able to use boost's functors, if you don't like
the homemade
functions (which I wouldn't recommand to use anyway). However I'm not
quite
sure there's that many people who tried it; It still an experimental
feature
(Even if it's in the main public version). There's many examples that
shows
how to use functors with cURLpp. Just read the README in the "examples/"
directory.

>
>>>> Dan
> --
> http://www.MoveAnnouncer.com The web change of address
> service
> Let webmasters know that your web site has moved

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFGW5dOqVQ4gFSsgnoRAhlWAKDraPDHBpIJtHAPxcGzC+6O6o3n0wCfbQl5
p0OfdKfFHfrkwbk2KbWFG64=
=ZRB7
-----END PGP SIGNATURE-----
Received on 2007-05-29