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

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


On 5/25/14, lvqcl <lvqcl.mail at gmail.com> wrote:
> Ozkan Sezer wrote:
>
>> 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.
>>
>
> I don't know how all this autoconf machinery works, but if I want to
> compile
> flac.exe that requires only system libraries (kernel32.dll and msvcrt.dll)
> then I simply use the following command:
>
> ./autogen.sh && ./configure --enable-static --disable-shared && make
>
> It worked earlier, and it works now with the current git sources.
> In this case libFLAC.la contains the following lines:
>
>      # The name that we can dlopen(3).
>      dlname=''
>
>      # Names of this library.
>      library_names=''
>
>      # The name of the static archive.
>      old_library='libFLAC.a'
>
> When ./configure is called without arguments, these lines contain:
>
>      # The name that we can dlopen(3).
>      dlname='libFLAC-8.dll'
>
>      # Names of this library.
>      library_names='libFLAC.dll.a'
>
>      # The name of the static archive.
>      old_library=''
>
> So libFLAC.la can point either to dynamic or to static library.
>

OK, I see.  Your problem is that static linkage doesn't work.
To make it work with dllexport/import attributes, the configury and
makefiles would need more massage as I explained: if there is
interest, I may try it some time.

>
> *********
> Also: your patch adds the following lines to several Makefile.am files:
>
>     if OS_IS_WINDOWS
>     win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la
>     endif
>
>     zzz_LDADD = ... $(win_utf8_lib) ...
>
> On my system win_utf8_io is always a static library and is statically
> linked
> to the libFLAC library, so it's not necessary to explicitly link flac.exe
> with libwin_utf8_io.la.

libFLAC itself links to libwin_utf8_io.a. Without the dllexport attribs
there is no need for those additions of mine. However with the patch in
effect, the dll won't export them any longer and the extra linkage will
become necessary.

--
O.S.


More information about the flac-dev mailing list