Hello,

I'm experiencing a difficulty using write callbacks and I'd like to
ask how/whether is possible to do what I have to do. I outline the
scenario briefly below:

* The callback I want to use is a public member function of class A.
The reasoning behind this is that I'd like to update some state in
this class (e.g. a member variable that holds bytes read so far), each
time the callback is called.

* The code that performs the curl read operations is in member
function of another class (class B), say B::readData( ).

* The way I'm implementing the above now (and is not working) is to
boost::bind the callback to the instance of A, pass the
boost::function object that bind returns to B::readData( ), and there
do the appropriate reinterpret_cast-ing to produce a C-style function
pointer that libcurl expects.

My question is whether libcurl supports/will support a different kind
of signature for the callback function, one with an extra (void *)
argument, where we can pass in some state (and thus make it a truer
sort-of-speak callback). Right now, there's no way to pass any state
to the callback from what I understand. If there were such an extra
argument, we could pass a pointer to an A object to the callback and
use it appropriately there.

I hope this was not very confusing.

Thanks
Alex
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to