bug-gnu-libiconv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gnu-libiconv] Avoid __declspec(dllexport) for MSVC static build


From: Bruno Haible
Subject: Re: [bug-gnu-libiconv] Avoid __declspec(dllexport) for MSVC static build
Date: Wed, 16 Aug 2023 00:55:38 +0200

Hi,

Dmitry Bely wrote:
> libiconv always defines BUILDING_DLL for its build. In the case of MSVC
> that in turn defines
> 
> # define RELOCATABLE_DLL_EXPORTED __declspec(dllexport)
> 
> That's unacceptable for a static library because if that library is linked
> into a user DLL, all its public symbols are automatically exported from the
> DLL.

If you configure with --disable-shared, only a static library will be built,
and this static library can be used for building executables.

The binary format you mention — a static library that is meant to be
included in shared libraries — is typically denoted 'static_pic'. Similarly,
a static library that is meant to be used in PIE executables is 'static_pie'.
But GNU libtool does not support generating such binaries out-of-the-box.

But probably, you can generate such binaries with
  --disable-shared CFLAGS=-fPIC
or similar.

The only remaining case is thus when a build creates both a shared library
and a static library at once.

> BUILDING_DLL should be defined only when shared libraries are built.

Can you provide a patch to this effect? Static libraries are low priority
for me, since shared libraries are well supported on all platforms for 25
years. If it is higher priority for you, can you share the patch? Thanks.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]