cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Crash using WRITEDATA callback depending on CUSTOMREQUEST sent!

From: Brian Dessent <brian_at_dessent.net>
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"'.

Brian
Received on 2007-03-14