Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why would the size of the final binary be so much smaller than the size of the static library?

This is an iOS question.

I build a static library (a framework in iOS) which is then included in an app. The size of the result binary (500kb) is smaller than the size of the static library (6mb). How does this work? My understanding of static library is that the static library is included in the final binary

like image 700
Evil Nodoer Avatar asked Mar 29 '12 21:03

Evil Nodoer


1 Answers

Because you are not using all the functions of your library. A static library of archive type .a is a collection of .o object files and only the object files needed in your program are included at link time.

like image 128
ouah Avatar answered Oct 02 '22 12:10

ouah