cURL / Mailing Lists / curl-users / Single Mail


Re: Mistake in user guide documentation regarding C++(lib-curl-the-guide)

From: Gisle Vanem <>
Date: Mon, 12 Jul 2004 11:47:55 +0200

"Nye, Jason" <> said:
> The statement saying "The callbacks must be Plain C" should be replaced
> with "The callbacks CANNOT be non-static class member functions". The
> discussion about extern "C" is all wrong. All extern "C" does is prevent
> name mangling and has nothing to do with the this pointer or how
> function pointers at runtime are interpreted.
What was meant was probably that the callback must be 'cdecl'.
Since libcurl probably cannot be compiled with MSVC and 'fastcall'
globally, all user-callbacks must also be 'cdecl'

But the callbacks should IMHO be decorated correctly.
In <curl/curl.h> do something like:

#ifndef __cdecl
#define __cdecl

typedef size_t (__cdecl *curl_write_callback)(char *buffer,
                                      size_t size,
                                      size_t nitems,
                                      void *outstream);
Received on 2004-07-12