Surprised by size of static libraries
Hi I have built static and shared boost_python libraries under Visual C++ 2008 under Windows and am surprised by the size difference. The commands I use are: C:\boost_1_43_0>bjam toolset=msvc-9.0 --with-python link=shared C:\boost_1_43_0>bjam toolset=msvc-9.0 --with-python link=static The resulting shared libraries are: boost_python-vc90-mt-1_43.dll 216KB boost_python-vc90-mt-gd-1_43.dll 500KB The resulting static libraries are: libboost_python-vc90-mt-1_43.lib 5.59MB libboost_python-vc90-mt-gd-1_43.lib 21.2MB Please can anyone explain why the static libraries are at least 25x larger than the shared libraries? Is there a way to reduce the size of the static libraries? Best regards David
2010/7/30 David Aldrich
Please can anyone explain why the static libraries are at least 25x larger than the shared libraries?
Is there a way to reduce the size of the static libraries?
this is beacause : - function name mangling are not stripped away in static libs - duplicate template instantiation are not stripped away in static libs This is the job of the linker. when finally linking, name mangling and duplicates are removed. this explains why dll are smaller than static libs. There is no whay to reduce the size of your static libs. This is compiler (or linker / template implementation / name mangling / whatever ) dependant...
participants (2)
-
David Aldrich
-
ecyrbe