cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: FTP Upload problem : crash

From: David Phillips <electrum_at_gmail.com>
Date: Mon, 22 Nov 2004 11:52:59 -0600

On Mon, 22 Nov 2004 11:34:50 -0500, Wei Weng <wweng_at_kencast.com> wrote:
> Daniel Stenberg wrote:
> Are you saying that the only way (if you want to do it through a file stream
> ) is to wrap the FILE* inside some other structure then pass the pointer to
> that structure along to the libcurl DLL?

No, libcurl cannot call it's own fread() on a FILE* passed to it,
since it might be using a different C runtime library than the
application. That is why you must provide a callback to read the
data.

This is true of most anything on Windows with DLLs. For example, you
shouldn't free() a pointer that a library created with malloc(). The
library should provide it's own free function.

You don't generally have this problem on UNIX type operating systems
because libraries link with the same libc that the application uses.

-- 
David Phillips <david_at_acz.org>
http://david.acz.org/
Received on 2004-11-22