question regarding binary size

Sergey Gromov snake.scaly at gmail.com
Wed Feb 6 09:33:27 PST 2008


Frank Skare Wrote:

> is it right that the pre processer strips most of the platform dependedend code of multi platform libraries like wxWidgets?

Yes.

> Let's assume I make a instance of a class defined in wxWidgets but don't call any methods in it, will all the code of the class end up in the binary and all code of classes referenced in that class?

If you link a library into your application, and some function never gets
called, it is dropped out by a linker.  If you build a dynamic library,
and some function never gets called from any of exported functions,
it is dropped out by a linker.  If you create an instance, all the methods
called and data referenced from its constructor will survive.

> If so then I don't understand how a C++ OOP programmer can accept the resulting increase in binary size and compilation time. I wonder if something like .NET's extension methods could have fixed this problem. Extension methods is a trick to use static methods like instance methods.




More information about the Digitalmars-d mailing list