cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Unhandled exception in VC++ 2010 with curl_easy

From: David Chapman <dcchapman_at_acm.org>
Date: Tue, 15 Sep 2015 12:12:38 -0700

On 9/15/2015 11:38 AM, Daniel Stenberg wrote:
> On Tue, 15 Sep 2015, William Elliott wrote:
>
>> I'm using VC++ 2010 and I'm getting this error:
>>
>> An unhandled exception of type
>> 'System.AccessViolationException' occurred in
>> Fourth.exe Additional information: Attempted to read or write
>> protected
>> memory. This is often an indication that other memory is corrupt.
>
> ...
>
>> curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);
>
> The answer is in http://curl.haxx.se/libcurl/c/CURLOPT_WRITEDATA.html
> and I quote:
>
> If you're using libcurl as a win32 DLL, you MUST use the
> CURLOPT_WRITEFUNCTION if you set this option or you will experience
> crashes.
>
> Due to how ownership of that FILE pointer is handled.
>

I don't think the wording here is at all clear. Are you saying that
when cURL is used as a Win32 DLL, fwrite is not a valid
CURLOPT_WRITEFUNCTION even if passed in explicitly? Or are you saying
that use of NULL as a CURLOPT_WRITEFUNCTION is not valid when cURL is
used as a Win32 DLL, and that a pointer to fwrite must be passed in (or
else the call should be skipped)?

In either case, the documentation in the CURLOPT_WRITEFUNCTION page
should have the same warning. You don't want pages to be inconsistent
with each other.

-- 
     David Chapman      dcchapman_at_acm.org
     Chapman Consulting -- San Jose, CA
     Software Development Done Right.
     www.chapman-consulting-sj.com
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2015-09-15