curl-library
Re: Crash using WRITEDATA callback depending on CUSTOMREQUEST sent!
Date: Thu, 15 Mar 2007 14:00:13 +0200
James Dennett wrote:
>
>> -----Original Message-----
>> From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-
>> bounces_at_cool.haxx.se] On Behalf Of Brian Dessent
>> Sent: Wednesday, March 14, 2007 12:52 PM
>> To: libcurl development
>> Subject: Re: Crash using WRITEDATA callback depending on CUSTOMREQUEST
>> sent!
>>
>> 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'.
>>
>
> There's no "this" in this case; the OP noted that this was a static
> member of the class. (Otherwise you'd need different syntax to take its
> address.)
>
>
>> You need to declare your callback 'extern "C"'.
>>
>
> That's true though, if you want to write portable code. Likely it's not
> the problem in this case though; most versions of Visual C++ use the
> same calling convention for C and C++ code by default so far as I know.
> Still, a good idea to Do The Right Thing and declare the calling
> convention/linkage appropriately.
>
> -- James
>
>
>
I totally agree with Brian and James, but obviously if it was the
problem it would crash each time I believe.
The fact "NST" dont crash is weird, actually
any custom request bigger than 3 letters makes _perform to crash while
using callback...
I tried to remove my callback from the class , and defined it as an
extern "C" but unfortunately the problem
is still here.
I did use recent platform sdk, for openssl, curl and my client , both
three has same dll usage (MULTITHREAD /MT).
I fear that I will need to debug inside _perform to see what is going on...
If someone has anything else in the meanwhile, will be greatly appreciated..
Kind Regards.
Arnaud
Received on 2007-03-15