cURL / Mailing Lists / curl-library / Single Mail

curl-library

(no subject)

From: Ben Helleman <Ben.Helleman_at_adobe.com>
Date: Wed, 18 Sep 2002 15:36:15 -0400

I have a issue with trying to get a call back function to work. For some
reason when WriteMemoryCallback is called a "The memory could not be read"
error occurs.
 
struct Memory {
    char * mem;
    int size;
}
 
The calling function does the following:
----------------------------------------------------------------------------
--------
    curl_handle = curl_easy_init();
    curl_easy_setopt(curl_handle, CURLOPT_URL, http://linkto/my/file
<http://linkto/my/file> );
    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION,
WriteMemoryCallback);
    curl_easy_setopt(curl_handle, CURLOPT_FILE, (void *)&chunk);
#if _DEBUG
    curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, TRUE);
    curl_easy_setopt(curl_handle, CURLOPT_HEADER, TRUE);
#endif
    curl_easy_perform(curl_handle);
    curl_easy_cleanup(curl_handle);
    cout << chunk.memory;
}
----------------------------------------------------------------------------
--------
 
NOW the picture below is of the WriteMemoryCallback function, even with all
that code commented out it still has an error.
 

 
As you can see the debug information is placed out, but during the call to
curl_easy_perform(curl_handle); it blows up in the call back function.
 
 
I'm quiet stuck at this point, not knowing if its a bug, or if I'm missing
something. I'm using visual C++ 6. I've included libcurl.lib, I've set my
processor definitions to include "NODEFAULTLIB:library", I've changed my
Code Generation to Use runtime library -> multithreaded dll. I'm also
linking against ws2_32.lib and winmm.lib. (OS Is Windows 2000 service pack
3)
 
 
Hope someone has a suggestion for me soon.
 
Thanks
 

----------------------------------------------------------------------------

--
Ben Helleman
Phone: 613-751-4800 x 5822
Email:  <mailto:Ben.Helleman_at_Adobe.com> Ben.Helleman_at_Adobe.com
Web Site: www.Adobe.com <http://www.adobe.com/> <?xml:namespace prefix = o
ns = "urn:schemas-microsoft-com:office:office" />
 

-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab

pictures.gif
Received on 2002-09-18