While studying the Qt framework, I’ve noticed that it’s littered with hundreds of overloaded functions scattered among all its classes. This makes me wonder how much these functions contribute to the size of the libraries.
Without going through a tedious process of eliminating each overloaded function, is it possible to determine how much they effect the final size of each library?
This question is not related to any project or problem I am having. It is pure curiosity.
In GCC the options to use are -ffunction-sections and -fdata-sections when compiling and –gc-sections when linking. This causes it to essentially create a graph of your program and drop any function, variable and so on that isn’t referenced.
For shared libraries, the shared lib takes all the code – they’re all in there (if possibly externally referenced) and you can’t change it either way.
If they’re essentially inline functions you are possibly even better off – they only serve to allow default parameters or such. Inline functions are also garbage collected with –gc-sections.