using libcurl without dll

There is no simple answer 🙂
Libcurl depends on other third party libs (it depends on binary distribution that you are using). As you get rid of DLL – you’ll have to link with corresponding third parties manually.

Ok, so the first point is that you should not link to libcurl.lib as it binds you to DLL which you don’t want to.

Second point – when you are linking with libcurl_static.lib then (as mentioned above) you’ll have also to link with libraries it depends on. Simple way to do that is to do something like this:

#if defined CURL_STATICLIB

#if defined _DEBUG
#pragma comment(lib, "libcurl-7.19.3-win32-ssl-msvc\\lib\\Debug\\curllib_static.lib")
#else
#pragma comment(lib, "libcurl-7.19.3-win32-ssl-msvc\\lib\\Release\\curllib_static.lib")
#endif

#pragma comment(lib, "ws2_32.lib")
#pragma comment(lib, "libcurl-7.19.3-win32-ssl-msvc\\libeay32.lib")
#pragma comment(lib, "libcurl-7.19.3-win32-ssl-msvc\\openldap.lib")
#pragma comment(lib, "libcurl-7.19.3-win32-ssl-msvc\\ssleay32.lib")

#endif

But this way – you’ll get three more dependencies. Alternatively, you can search for a way to link with them statically, but it is a different story.

As another alternative – you could rebuild libcurl_static.lib from sources after disabling all the features you don’t need thus removing unwanted dependencies (as described in “Disabling Specific Protocols in Win32 builds” of INSTALL file).

And final point – as libcurl has quite poor support for windows compilation from sources, I’d recommend you to revisit the idea of getting rid of curllib.dll.

Leave a Comment