cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Crash in the DLL

From: Steve Lhomme <steve.lhomme_at_free.fr>
Date: Sun, 26 Aug 2001 20:46:21 +0200

Oops, sorry for not RTFM !

It's good to know I was not doing something wrong with the code.
Do you know why this happen ? It's a bit strange...

----- Original Message -----
From: "Daniel Stenberg" <daniel_at_haxx.se>
To: "libcurl Mailing list" <curl-library_at_lists.sourceforge.net>
Sent: Sunday, August 26, 2001 6:28 PM
Subject: Re: Crash in the DLL

| On Sun, 26 Aug 2001, Steve Lhomme wrote:
|
| > I've build the DLL with Visual C++ 6, and with the simple FTP example,
it
| > crashes when writing into the file ! So I've tried to debug it, and it's
| > on the data->fwrite. So I tried a static build and it worked !
| >
| > I really didn't understand what happened. I've tried calling the
standard
| > fwrite in the DLL and out of the DLL with exactly the same parameters
| > (same string, length, stream). And it crashes in the DLL and not inside
!
| > (in the same program/run)
|
| I think the answer can be found in the FAQ, item 5.5:
|
| 5.5 Does CURLOPT_FILE and CURLOPT_INFILE work on win32 ?
|
| Yes, but you cannot open a FILE * and pass the pointer to a DLL and have
| that DLL use the FILE *. If you set CURLOPT_FILE you must also use
| CURLOPT_WRITEFUNCTION as well to set a function that writes the file,
even
| if that simply writes the data to the specified FILE*. Similarly, if you
| use CURLOPT_INFILE you must also specify CURLOPT_READFUNCTION.
|
| (Provided by Joel DeYoung and Bob Schader)
|
| ... and in fact in the man page for curl_easy_setopt() in the CURLOPT_FILE
| there's also this text:
|
| NOTE: If you're using libcurl as a win32 DLL, you MUST use the
| CURLOPT_WRITEFUNCTION if you set this option.
|
| Of course, I should correct that example so that it'll work on windows too
| from the start.
Received on 2001-08-26