cURL / Mailing Lists / curl-library / Single Mail

curl-library

compile libcurl into the application (MSVC)

From: Cyber Core <cybercorecentre_at_gmail.com>
Date: Tue, 14 Jul 2009 10:23:03 +0200

Hi,

A year ago or so I started a discussion about how to compile curl into an
application so you won't require the dlls for it. I didn't get any useful
answer so I ask it again.
Currently what I do is to put the dlls into the final application as
resources then I delay the dll loading and extract them to the application's
working directory.

#pragma comment(lib, "delayimp.lib")
#pragma comment(lib,"libcurl_imp.lib")
#pragma comment(linker, "/DELAYLOAD:libcurl.dll")
#pragma comment(linker, "/DELAYLOAD:libeay32.dll")
#pragma comment(linker, "/DELAYLOAD:ssleay32.dll")
#pragma comment(linker, "/DELAYLOAD:zlib1.dll")

 #include <curl/curl.h>
 #include <curl/types.h>
 #include <curl/easy.h>

What I got answer was:

"These are Release MT files (static/static as I remember). If you change
your project to MT you'll also need to link against, and
possibly recompile, any other libs. For instance, if you're using DirectShow
you'll need a Release MT version of strmbase.lib (see
attached). Presumably you're using Microsoft Visual C++/Studio.

Here are the relevant comments from my source:

//I've switched to /MT (from /MD) and used MT versions of
libcurl.lib,ssleay32.lib,libeay32.lib.
//An MT version of strmbase was put into ..\..\BaseClasses\Release_MT\
----NOTE "_MT"
//Hopefully this doesn't mess up anything.

/As of 2007.12.05 this libcurl.lib was ver 17.7.1 using 'nmake vc-ssl'
//with CURL_LDAP_DISABLED. openssl 0.9.8g. no zlib.
#define CURL_STATICLIB //prevents dynamic linking. same as -DCURL_STATICLIB
#include <curl/curl.h>"

I would note that I use MSVC 6 and I compile my projects in multithreaded
release mode. Now the very first error I get is the usual security cookie
blah blah from msvc which happens when you try to link together different
lib files eg: MT with MD, MT with MTD etc.

So someone please tell me first where to get the statically linkable curl
libs for msvc6 if they exist at all?
Also what I didn't found on the curl download site is the project to build
the libs themselves. Most of the downloadable archives contains the headers
and precompiled lib files.

Please someone write it down step by step from 0 what to download, how to
build the static library, how to link it with the final app etc.

Thanks
Jax
Received on 2009-07-14