cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How come the function works but the class doesn't?

From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Sat, 23 Oct 2010 00:58:45 -0400

On Sat, Oct 23, 2010 at 12:28 AM, Alexander Tairbekov
<alex.tairbekov_at_gmail.com> wrote:
> I have been struggling with this for some time now. This is my problem.
> I have 2 sets of code, one that uses a function and another that uses a
> class.
> The set of code using a function works fine, but the code using the class is
> not working, which is not good because I am trying to make my project in
> class form.

libcurl is a C library with no knowledge of C++ concepts like a this
pointer for function or data access. Function pointers you set should
therefore be normal C-style functions, or static C++ class/struct
member functions (with the implication that these callback functions
does not have access to a particular class instance or its member
variables as usual).

Or you could use some existing C++ wrapper library for libcurl.

Lars Nilsson
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-10-23