cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl compiles w/ MinGW but doesn't work

From: Gisle Vanem <giva_at_bgnett.no>
Date: Tue, 14 Mar 2006 16:57:55 +0100

"Damien Pierce" <emaildmp_at_yahoo.com> wrote:

> I found that the key was I need -DCURL_STATICLIB when
> compiling the source file (but not when linking it to
> the curl lib(!)). I previously thought that flag was
> only needed when compiling the library.

Wrong, wrong. When in doubt, look at the code. From <curl/curl.h>:

#if (defined(WIN32) || defined(_WIN32)) && !defined(CURL_STATICLIB)
  #if defined(BUILDING_LIBCURL)
    #define CURL_EXTERN __declspec(dllexport)
  #else
    #define CURL_EXTERN __declspec(dllimport)
  #endif
#else
  #define CURL_EXTERN
#endif

Isn't that enough to answer your questions? I.e. '-DCURL_STATICLIB'
puts no __declspec decorations on any public functions when either
using o building libcurl. Omitting it, puts in import/export decoration
as needed.

--gv
Received on 2006-03-14