[flac-dev] make dllimport/dllexport attributes work with mingw (and others)

Ozkan Sezer sezeroz at gmail.com
Sun May 25 03:09:11 PDT 2014


On 5/25/14, lvqcl <lvqcl.mail at gmail.com> wrote:
> Erik de Castro Lopo wrote:
>
>> Ozkan Sezer wrote:
>>
>>> My apologies, obviously sent an old testing patch. Correct one is
>>> attached (declspec2.diff). Compilation tested using MinGW (gcc-3.4.5,
>>> binutils-2.20), and MinGW-w64 (gcc-4.5.4, binutils-2.21.90.)
>>
>> lvqcl,
>>
>> Can you please validate this new patch?
>
> It works, but only if i call ./configure without arguments. And it fails
> if i call ./configure with "--disable-shared", "--enable-static" or
> both "--disable-shared --enable-static".
>

Your configury already has the line
LT_INIT([win32-dll disable-static pic-only])
... so I took the assumption of dll builds are supported only.

Your configury already has the line
LT_INIT([win32-dll disable-static pic-only])

--disable-shared can be supported, but that would require some more
major surgery: the flac build has a shared configury for both the
library and the player, etc apps, therefore for the --disable-shared
option to work, the CFLAGS must be added -DFLAC__NO_DLL (I think),
but that would complicate the cases where both static and the shared
libraries are built.

>
> (If I use ./configure without arguments then flac.exe requires
> libFLAC-8.dll,
> which in turn requires libgcc_s_sjlj-1.dll. Adding "--disable-shared" makes
> flac.exe standalone: it doesn't need those libraries thst are foreign to
> Windows systems).

flac.exe built with mingw with or without the dllimport/dllexport patch
always requires libFLAC-8.dll (because flac/Makefile.am has libFLAC.la
in flac_LDADD and not libFLAC-static.la), and the patch doesn't make it
any more or any less dependent on any 'foreign' dlls: the patch doesn't
change the existent situation in that regard. If I'm missing something,
please explain.

--
O.S.


More information about the flac-dev mailing list