On 8/8/2017 6:27 PM, Reino Wijnsma wrote:
> I guess I didn't phrase my question right. I should've asked: "Is it
> possible at all to compile *a shared libcurl.dll* using statically
> built dependencies?".
> In other words: I wish to end up with a '/curl.exe/' that relies on a
> '/libcurl.dll/' which has all the statically built dependencies
> integrated / imported (gmp, nettle, gnutls and zlib).

I'm sure this is possible but I don't think any of the build systems
support it. For autotools at least I know it's difficult. You'd have to
stop using -static in LDFLAGS and then modify the libtool script shared
section after configure completes. In the libtool script there's
archive_cmds which is what makes the dll. It will look something like this:

# Commands used to build a shared archive.
archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags -o
\$output_objdir/\$soname \$wl--enable-auto-image-base -Xlinker
--out-implib -Xlinker \$lib"

deplibs are all the dependencies that will be added, -lz etc. What you
can do is make all the dependencies static by signalling static before
deplibs and then go back to shared afterwards:
-Wl,-Bstatic \$deplibs -Wl,-Bdynamic

That's probably not all you'll have to do, it would also involve adding
-static-libgcc and maybe pthreads if the compiler adds it just by
default, but offhand I don't know how to do that one as static in a DLL
from mingw-w64 gcc.


-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to