cURL / Mailing Lists / curl-library / Single Mail


Re: Crash using WRITEDATA callback depending on CUSTOMREQUEST sent!

From: Brian Dessent <>
Date: Wed, 14 Mar 2007 12:51:58 -0700

Arnaud Maye wrote:

> /* Declare my call back */
> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteData);
> [...]
> size_t ShellUpdater::WriteData(void *buffer, size_t size, size_t nmemb,
> void *userp)

You're providing a C++ function where a C one is required. Calling a
C++ function from C will always fail, because the first parameter to
every C++ function is the implicit 'this'. You need to declare your
callback 'extern "C"'.

Received on 2007-03-14