Let's say we have a some library compiled into .a file. Aft开发者_如何学Cer that this library is linked with other code into some executable file .exe. Size of .a file is 6Mb while this size of .exe file is 3Mb. Obvious explanation of this is that linker has thrower out unused code from the library. What I want to know is the real library's code footprint in final executable file.
Check out the linker options. Linkers usually have an option to generate a map file. Which is a list of functions linked into the final image and where they came from. Sounds like you are using gcc, use the -map option.
A library has implementation of a lot of functions. An exe use some of there. The liker add in exe only the code of functions which exe use.
精彩评论