cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: static link libcurl with VS2010 causes crash

From: JonathonS <thejunkjon_at_gmail.com>
Date: Thu, 1 Mar 2012 14:01:57 -0800

I am still stuck on this :( It looks like I am building libcurl
correctly, yet it still crashes.

Would anyone know where I can get a pre-built libcurl (and openssl)
static library for VS2010 of 7.24.0?

I checked the pre-built binaries for the libcurl on the curl page, and
they are outdated for MSVC and I am not sure if theya re using MSVC
2010.

Thanks,
J

On Wed, Feb 22, 2012 at 5:20 PM, JonathonS <thejunkjon_at_gmail.com> wrote:
> Thanks guys for the help.  I tried linking statically as described
> below and it did produce a static library; however, it is still
> crashing.  It is crashing here in asyn-thread.c when it is trying to
> free the hostname.
>
>  /*
>  * destroy_async_data() cleans up async resolver data and thread handle.
>  */
> static void destroy_async_data (struct Curl_async *async)
> {
>  if(async->hostname)
>    free(async->hostname);  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>
>  if(async->os_specific) {
>    struct thread_data *td = (struct thread_data*) async->os_specific;
>
>    if(td->thread_hnd != curl_thread_t_null)
>      Curl_thread_join(&td->thread_hnd);
>
>    destroy_thread_sync_data(&td->tsd);
>
>    free(async->os_specific);
>  }
>  async->hostname = NULL;
>  async->os_specific = NULL;
> }
>
>
> Here is how I set the hostname (URL) in my code
>
> curlStatus = curl_easy_setopt(m_hCurl, CURLOPT_URL, szURL)
>
> where szURL is a local char* variable.
>
> any help would be greatly appreciated :) I've been stuck on this thing
> for 2 weeks now.
>
> Thanks,
> J
>
>
> On Tue, Feb 21, 2012 at 10:27 AM, Ward Willats <libcurl_at_wardco.com> wrote:
>> At 8:31 AM -0800 2/21/12, JonathonS wrote:
>>>
>>> Note that I built libcurl myself and linked dynamically, and
>>> everything worked fine.  So, this must be something specifically to
>>> static linking.
>>
>>
>> Think this free() problem is probably pilot error.
>>
>> I built and linked libcurl 7.32.1 and SLL statically about 2 months ago
>> under Win7. Been using the output binaries from that since to HTTP POST and
>> GET with the easy interface and works fine. Had to use the nmake makefiles,
>> and had to patch them.
>>
>> In MakefileBuild.vc on line 104:
>>
>>     SSL=dll
>>
>> should be:
>>
>>     SSL=static
>>
>> ...I think Daniel fixed this. Also I had to change:
>>
>> winbuild/MakefileBuild.vc line 102 from:
>>
>> SSL_LIBS     = libeay32.lib ssleay32.lib
>>
>> to:
>>
>> SSL_LIBS     = libeay32.lib ssleay32.lib gdi32.lib user32.lib advapi32.lib
>>
>> ...for OpenSSL 1.0.0e linkage.
>>
>> My namke line (YMMV):
>>
>> nmake -f Makefile.vc MODE=static VC=10 WITH_SSL=static DEBUG=yes
>> WITH_DEVEL=../../deps USE_SSPI=no USE_IDN=no clean
>>
>> I also have this cryptic note: "Need CURL_STATICLIB in cflags"
>>
>> -- Ward
>>
>> -------------------------------------------------------------------
>> List admin: http://cool.haxx.se/list/listinfo/curl-library
>> Etiquette:  http://curl.haxx.se/mail/etiquette.html

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-01