cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Static Libcurl crashes on MSVC13

From: Gisle Vanem <gvanem_at_yahoo.no>
Date: Fri, 26 Feb 2016 13:17:25 +0100

Jules van der Toorn wrote:

> Thanks for the quick answer! I don't think it's an error in my code, because i literally copied the code from your site,
> the imap-fetch <https://curl.haxx.se/libcurl/c/imap-fetch.html> code (curl.haxx.se/libcurl/c/imap-fetch.html
> <http://curl.haxx.se/libcurl/c/imap-fetch.html>), and that did work previously when i had the dynamic libcurl library.

The important detail was:
  "Debug Assertion Failed! Expression: _CrtIsValidHeapPointer(pUserData)"

It usually means you're mixing code built with different C-RunTime libraries.
Like mixing debug (-MDd, -MTd) and release (-MD, -MT) objects. That could
happen easily when you go from a dynamic use of libcurl to a static build.
Since in a libcurl.dll it would malloc/free it's own memory. But when you
link all statically, the linker forces only 1 'free' and 1 'malloc' in the
resulting .exe (one can never have multiple symbols in the same PE-image).

To figure this out, make a more detailed .map-file; add '-verbose'
and see where malloc() and free() are really coming from.

Good luck.

-- 
--gv
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-02-26