curl-library
Re: CURLOPT_DEBUGFUNCTION again
Date: Sat, 23 Feb 2008 19:11:42 +0100
Anton Fedorov schrieb:
> Hello, Michael.
>
> Your wrote 23 февраля 2008 г. 22:58:52:
>
> MH> sorry, but I still have got some problems with CURLOPT_DEBUGFUNCTION or
> MH> rather with static functions in general.
>
> MH> I want to pass data from the debugfunction to the member-function of a
> MH> class, which is declared non-static.
>
> static function haven't self pointer. you should send self pointer as
> CURLOPT_DEBUGDATA, and call non-member function with that self
> pointer.
>
> Any additional info, if you need, you should store in class. If one
> class need to have several data for several curl pointers, you need
> store in array, with map curl pointer -> additional data.
>
> MH> static int my_trace(CURL *handle, curl_infotype type, unsigned char
> MH> *data, size_t size, void *userp)
> MH> {
> MH> // Here I'm doing something with curl's debug data and now I
> MH> want to pass the data to my CHeader-Class, which is not possible the way
> MH> I'm trying to do it
> MH> request_header.ADD_REQUEST_HEADER_DATA(mySTR);
> here you have no access to internal data. use userp as pointer to
> self. try here something like
> ((Cmy_Communicator*)userp)->request_header.ADD_REQUEST_HEADER_DATA(mySTR);
> MH> }
> MH> }
>
>
Hello Anton,
thank you again!
It works now.
Received on 2008-02-23