curl-library
Re[2]: [Patch] Disable multi API support
Date: Wed, 29 Oct 2008 21:37:42 +0300
Hello,
PB> On Tue, 2008-10-28 at 23:52 -0700, Dan Fandrich wrote:
>> When linking with static libs, the linker will not include modules that
>> aren't used. So most of the multi functions will be automatically excluded
>> with no changes to the libcurl ABI. Some things could possibly be
>> rearranged slightly in the source to give the linker more leeway in this,
>> though.
The question is, which modules are really unused. :) Note that linkage
is done on a per-file basis - so if ANY of functions in a file refer
to functions in the other object file, that file will be linked in in
its entirety. Of course, function-level linkage (see below) may
improve this, but who uses it anyway? :)
PB> If you compile the library with -ffunction-sections, and link with
PB> -Wl,--gc-sections, the compiler will be able to throw away unused code
PB> at the granularity of functions rather than files. No rearrangement of
PB> the source required :-)
This is true for GCC, but not true for other compilers - they may or
may not have similar functionality.
Besides, using function-level linkage significantly slows down the
build process (may be an issue for big projects).
Anyway, the idea is good - I shall give it a try... that is, if I find
similar options for MSVC compiler. :) Thank you Phil - I didn't
realize GCC had these options.
PS: Aha, Microsoft offers /Gy and /OPT:REF options for compiler and
linker, correspondingly.
-- Best regards, Tetetest mailto:tetetest_at_rambler.ruReceived on 2008-10-29