cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: defining CURL_STATICLIB in libcurl.pc

From: Mark Brand <mabrand_at_mabrand.nl>
Date: Thu, 24 May 2012 23:53:26 +0200

Daniel Stenberg wrote:
> On Thu, 24 May 2012, Mark Brand wrote:
>
>> However, naively linking Windows applications to static libcurl does
>> not work due to CURL_EXTERN introducing the dreaded _imp prefix in
>> the public headers.
>>
>> It seems like a reasonable measure to me to add -DCURL_STATICLIB to
>> Cflags in libcurl.pc. This defines away CURL_EXTERN and linking works
>> as expected. Or is there a better way?
>
> Wait, you're using libcurl.pc on windows?

Yes, libcurl.pc works nicely in a static mingw setup such as MXE
(formally mingw-cross-env).

> And can we really do that to libcurl.pc without ruining how it is used
> for "normal" shared linking?

-DCURL_STATICLIB should appear in libcurl.pc only when libcurl is built
only as a static library. I imagine this should be sensitive to the
configure option '--disable-shared'.

This solution is not suitable for a configuration building both static
and shared libcurl, but I don't think this can be done using mingw
anyway, which is the important case.

Mark

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-05-24