svaa schreef: > Vincent Snijders escribió: >> No, the initialization section of the graphics unit and its dependencies >> is used. The lesson is: you cannot smart link away initialization (and >> finalization) sections of a unit. >> > Why not? > > Is there are a design reason for such behavior? > > I mean. > Is there a reason why a linker should never remove such sections? > Or the problem is that it is too difficult and complex to implement > such a smart compiler/linker?
Initialization sections may be used to register things. For example if you include the interfaces unit, then you create the WidgetSet object for the chosen widgetset. No other code is in that unit, but it is needed for proper working of an LCL application (remove the interfaces unit from .lpr file to see what I mean). So it would be wrong for the compiler not to call the initialization section of that unit, even if it is not used later. Vincent _______________________________________________ Lazarus mailing list Lazarus@lazarus.freepascal.org http://www.lazarus.freepascal.org/mailman/listinfo/lazarus