curl-users
Re: ftpupload.c crash (Win32 libcurl DLL) Help me
Date: Mon, 16 Jun 2008 05:17:41 +0200
Hi again,
On Sun, Jun 15, 2008 at 11:15 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Sun, 15 Jun 2008, Cyber Core wrote:
>
> So I found a similar topic on this mailing list, I try to keep the same
>> one.
>> I tried various versions of that ftp uploader C example.
>>
>
> That's a libcurl issue so curl-library would be a more suitable list to
> take this subject to.
>
Ah ok.
>
> Even the recent version crashes with some memory error.
>>
>
> "the recent version" being 7.18.2? What exactly does "some memory error"
> mean?
>
The exact version what I talk about is:
http://cool.haxx.se/cvs.cgi/curl/docs/examples/ftpupload.c
>
> I can copy more details later but it should be the same problem like the
>> other guy had who started the thread.
>>
>
> What thread?
http://curl.haxx.se/mail/lib-2008-01/0117.html
>
>
> Could you take a look and fix it please.
>>
>
> If you tell us more details we might be able to help!
>
I recompiled it today, modified the upload file name, added verbose
logging, user:pass for ftp and guess what it worked as standalone
application. Of course I want to use this as a function in my C program,
where I got the following errors:
error C2664: 'fread' : cannot convert parameter 4 from 'void *' to 'struct
_iobuf *'^M
Conversion from 'void*' to pointer to non-'void' requires an
explicit cast^M
This occurs at the:
/* NOTE: if you want this example to work on Windows with libcurl as a
DLL, you MUST also provide a read callback with CURLOPT_READFUNCTION.
Failing to do so will give you a crash since a DLL may not use the
variable's memory when passed in to it from an app like this. */
static size_t read_callback(void *ptr, size_t size, size_t nmemb, void
*stream)
{
/* in real-world cases, this would probably get this data differently
as this fread() stuff is exactly what the library already would do
by default internally */
size_t retcode = fread(ptr, size, nmemb, stream);
fprintf(stderr, "*** We read %d bytes from file\n", retcode);
return retcode;
}
part. What I have no idea what it is. If you want i can put the modified
code to pastebin but I just modified the main's name to ftpupload and trying
to call it from my main program.
Regards
Jax
>
> --
>
> / daniel.haxx.se
>
Received on 2008-06-16