lvqcl
2014-May-25 09:47 UTC
[flac-dev] make dllimport/dllexport attributes work with mingw (and others)
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". (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).
Ozkan Sezer
2014-May-25 10:09 UTC
[flac-dev] make dllimport/dllexport attributes work with mingw (and others)
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.
lvqcl
2014-May-25 14:24 UTC
[flac-dev] make dllimport/dllexport attributes work with mingw (and others)
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.
Maybe Matching Threads
- make dllimport/dllexport attributes work with mingw (and others)
- make dllimport/dllexport attributes work with mingw (and others)
- make dllimport/dllexport attributes work with mingw (and others)
- make dllimport/dllexport attributes work with mingw (and others)
- make dllimport/dllexport attributes work with mingw (and others)