Archived Forum Post

Index of archived forum posts


The Size of a C/C++ Static Library? Too Large?

Dec 23 '15 at 00:44

We are considering using the Chilkat iOS library for parsing MIME emails. However, the compiled lib seems to amount to approximately extra 12MB on on top of our binary. The offered functionality is suitable for us, but the size is really prohibitive for our app. Is there a way to utilize only the functionality relevant to MIME and have this size significantly reduced?


When an application links with a C/C++ static library, the linker should only include the library code that is directly or indirectly referenced by the application. The size of a static library is meaningless because what matters is the size of your executable after linking with the library.

This is true unless you link specifically with a linker options that forces the entire contents of the static library to be included in the executable. Xamarin is a case where this happens, and this is why Chilkat provides the static libs for Xamarin in layers, slices, and packs.

Some technologies, such as MIME (which includes S/MIME), can result in a surprisingly large size increase to the executable. This is because there is a LOT of underlying technology involved -- relating to encryption, compression, character encoding, etc.