recently managed to use a libcurl in a test program for downloading a files. The code is this:
CURL * curl;
FILE * fout;
CURLcode result;
char * url = "http://blablabla.com/blablabla.txt";
char filename[FILENAME_MAX] = "blablabla.txt";
curl = curl_easy_init();
if (curl)
{
fout = fopen(filename,"wb");
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fout);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
fclose(fout);
}
and those things for directives:
#define CURL_STATICLIB
#include <curl/curl.h>
My question is how to make that I don't need to copy all of its dlls in the same dir with the exec to make it work:
libcurl.dll
libeay32.dll
libidn-11.dll
librtmp.dll
libssh2.dll
libssl32.dll
zlib1.dll
Cannot find info about that in the homesite (http://curl.haxx.se) of the library :|
You mean, "how do I statically link libcurl"?
5.7 in the FAQ says:
When building an application that uses the static libcurl library, you must add
-DCURL_STATICLIB
to yourCFLAGS
. Otherwise the linker will look for dynamic import symbols. If you're using Visual Studio, you need to instead addCURL_STATICLIB
in the "Preprocessor Definitions" section.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With