cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: vc++ still having problems

From: Igor Polyakov <ipolyakov_at_issart.com>
Date: Fri, 2 Sep 2005 11:57:49 +0700

Hello, JB,

Friday, September 2, 2005, 6:39:39 AM, you wrote:

> Out of the box, the curl.exe does not even compile clean. nmake with any of
> the targets that link curl.exe always fail with at least four unresolved
> symbols starting with __imp__. The snapshot yeilds same results as released
> version. I think that is great that there lots of windows users out there
> using this but I am guessing the vast majority is using the dll. However, I
> need the static lib and having a hell of a time getting it to work. If it's
> on my end, ok, but someone somewhere must have an idea of what I am doing
> wrong? I have even followed several documents and articles I've found on
> the net also with no luck.

Try build libcurl with the following command-line:

nmake -f Makefile.vc6 CFG=debug-ssl

Create new console project in VC, copy code of your program to the
source file of this project.

Set C/C++->Code Generation->Runtime Library option to "Multi-Threaded Debug
DLL" (/MDd), to make it the same to RTL with which libcurl was
compiled (see CCDEBUG in makefile.vc6).

Set the Linker->Input->Additional Dependencies option to "libcurld.lib
wsock32.lib libeay32.lib ssleay32.lib winmm.lib".

Set C/C++->Preprocessor->Preprocessor Definitions to
"WIN32;_DEBUG;_CONSOLE;CURL_STATICLIB".

Build your program in debug configuration and enjoy !

The key was to define CURL_STATICLIB macro.

> res = curl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer);

Have you read documentation for this option ?

CURLOPT_WRITEDATA

Data pointer to pass to the file write function. Note that if you specify
the CURLOPT_WRITEFUNCTION, this is the pointer you'll get as input. If you
don't use a callback, you must pass a 'FILE *' as libcurl will pass this to
fwrite() when writing data.

You shoyld pass FILE * as argument for this optionn, but you pass
std:sring * - this is UB. So if you would remove this line (and if
statment) from your program, it should compile, link and work fine.

-- 
Best regards,
 Igor Polyakov                            mailto:ipolyakov_at_issart.com
Received on 2005-09-02