curl-library
Crash when using libcurl as part of a project - Visual Studio 2005
Date: Mon, 29 Oct 2007 05:32:07 -0700 (PDT)
Hi,
I've included libcurl sources into an open source project of mine and i
use it to connect to a website to retrieve some data and also to upload
a file to a ftp address.
I'm using the source code for libcurl itself in the project, i am not
using libcurl as a dyanamic library.
I have built and tested the project (a dynamic library, plugin for
another program) and it works just fine in Debug mode.
But if i use the same dll but compiled in Release mode i get a crash in
curl_easy_perform(). I've traced through the call stack a bit and i've
noticed that the line it fails in is from hash.c, line no 99:
h = (struct curl_hash *) malloc(sizeof(struct curl_hash));
The callstack also shows malloc.c above hash.c and the error is invalid
access to memory location, 0x00000000.
[1]
I have tried building both /MD (Multi threaded DLL) and /MT (Multi
threaded) versions of the plugin but they both crash.
If I build with the debug version of the runtime, either /MDd or /MTd
everything works fine, the plugin does not crash anymore.
Another weird part is that even if I build in Release mode but use
Visual Studio to start the application then i do not get the crash
anymore - i have to start the application from outside Visual Studio
and then the crash occurs immediately.
Any ideas ?
I call both curl_global_init(CURL_GLOBAL_ALL); and curl_easy_init()
before calling curl_easy_perform()
[1]
(
it seems as though there's something wrong with the memory functions
that curl knows about.
If I compile the curlib project with the most verbose warning setting
turned on I get the following warning:
.\easy.c(205) : warning C4232: nonstandard extension used :
'Curl_cmalloc' : address of dllimport 'malloc' is not static, identity
not guaranteed
d:\usr\Microsoft Visual Studio 8\VC\include\stdlib.h(594) : see
declaration of 'malloc'
)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Received on 2007-10-29