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

lvqcl lvqcl.mail at gmail.com
Sun May 25 07:24:18 PDT 2014


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.


*********
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.


More information about the flac-dev mailing list