curl-library
msys2/mingw32 linking dll to libcurl.a suppresses DLL exports
Date: Fri, 15 Feb 2019 18:10:19 +1100
I'm finding this a bit bizarre. I feel like I'm missing something obvious.
I have a very simple test dll with function "int zzz_init(void)" that
uses curl.
Dynamically:
------------
/C/msys64/mingw32/bin/gcc.exe -O2 -Wl,--allow-multiple-definition
-shared -o libzzz.dll -Wl,--out-implib,libzzz.dll.a
-Wl,--major-image-version,3,--minor-image-version,0 -Wl,--whole-archive
CMakeFiles/zzz.dir/objects.a -Wl,--no-whole-archive -lcurl -Wl,-Bstatic
-lssl -lcrypto -lxml2 -ljansson -static-libgcc -lpsl -lidn2 -lnghttp2
-lcrypt32 -lunistring -lssh2 -lbrotlidec-static -lbrotlicommon-static
-lz -llzma -lintl -liconv -lwldap32 -lwsock32 -lws2_32 -lgdi32
-lcomdlg32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32
-loleaut32 -luuid -lcomdlg32 -ladvapi32
zzz_init exists:
$ nm _build/mingw32-Release/atoakm3/libzzz.dll.a | grep zzz_init
00000000 I __imp__zzz_init
00000000 T _zzz_init
Statically:
-----------
/C/msys64/mingw32/bin/gcc.exe -O2 -Wl,--allow-multiple-definition
-shared -o libzzz.dll -Wl,--out-implib,libzzz.dll.a
-Wl,--major-image-version,3,--minor-image-version,0 -Wl,--whole-archive
CMakeFiles/zzz.dir/objects.a -Wl,--no-whole-archive -Wl,-Bstatic -lcurl
-lssl -lcrypto -lxml2 -ljansson -static-libgcc -lpsl -lidn2 -lnghttp2
-lcrypt32 -lunistring -lssh2 -lbrotlidec-static -lbrotlicommon-static
-lz -llzma -lintl -liconv -lwldap32 -lwsock32 -lws2_32 -lgdi32
-lcomdlg32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32
-loleaut32 -luuid -lcomdlg32 -ladvapi32
zzz_init does not exist:
$ nm _build/mingw32-Release/atoakm3/libzzz.dll.a | grep zzz_init
The only difference is that -lcurl is after -Wl,-Bstatic not before.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-02-15