cURL / Mailing Lists / curl-library / Single Mail


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

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

"Damien Pierce" <> 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)
    #define CURL_EXTERN __declspec(dllimport)
  #define CURL_EXTERN

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.

Received on 2006-03-14