From: nisse@lysator.liu.se (Niels Möller) Cc: alexpux@gmail.com, nettle-bugs@lists.lysator.liu.se Date: Fri, 29 Nov 2013 16:53:11 +0100
And it's equally impossible to omit -lgmp when linking libhogweed.dll, and only add -lgmp when linking the executable?
Not if libhogweed calls functions from libgmp.
For ELF systems, if libhogweed is dynamic and libgmp is static, is it still the right thing to do to link libhogweed with -lgmp, which will copy needed gmp objects into libhogweed.so?
I'm not an expert, but I think it is. Unix allows a shared library to be generated with unresolved references, which are then resolved at run time. By contrast, on Windows all the references must be visible at link time, and are hard-coded into the DLL. This is why Windows will refuse to run an executable that references a DLL which is missing.
No, the symbols from libgmp are copied into the libhogweed _import_ library libhogweed.dll.a. The import library is a static library.
I admit I don't understand all the fine details here. But that sounds undesirable, the import library is intended to only contain thin glue to the dll?
The import library contains short functions each of which has a single instruction: an indirect jump to the address of the real function in its DLL. The import library itself is a static library, so that these indirect jumps are statically linked into the program.