I have code shared by several projects in a static library. Even with a binding to the functional level, I get more object code than I would like in the output - see Another question about this .
Of course, the easiest solution to reduce the amount of object code associated with the final executable would be to split the translation units so that I get more .obj files with less object code. I can even go to extremes - put each function in a separate translation unit.
Suppose I don't care about the mess caused by having ten times as many .cpp files, and I don't care about a possible increase in link time.
Will such a partition into many object files impose an overhead on the executable size? Will the executable file become larger simply because it has ten times as many .obj files (but in general they have exactly the same functions and variables)?
source share