|
|
IntroductionIf you have examined closely some of the OWL/OWLNext source files, you may have found lines like these:
In case you are wondering what is the purpose of these lines, I will offer an explanation. Static librariesStatic libraries are a collection of compiled source files. Usually one .c or .cpp file, containing several methods, compiles to one .obj file, which is then placed in the library. When a program calls one of these methods, the linker has to get the .obj file and link it to the program. Now, Microsoft linker is smarter, it supports &function level linking& (/Gy option), meaning that only the code for the actually used function is linked in the application. Borland linker does not have this functionality, and links the whole .obj file, usually resulting in larger application size. Borland's workaroundTo fix this situation in the OWL framework, Borland have implemented splitting large
source files in smaller chunks. In the source code, lines like this: This solution leads to decrease in the size of the application - the aclock example built with sectioned OWLNext static library is about 600K is size, and with unsectioned library the size grows to over 800K. Pros and consFor programmers using Borland/Codegear development tools, and static linking to OWLNext libraries, there will be the advantage of a reduced application size. For those using dynamic linking, there is no effect, sectioning is not used when building the DLLs. For programmers using Visual C++, it's linker will link only the necessary functions from the OWLNext library, which would result in smaller executable size in most cases - sectioning is not used when building with VC++. The main disadvantage is for the library developers, as the sectioning leads to more complex makefiles and build process, especially if decided to add sectioning to more source files. Sectioned source files in OWLNext
|
|||||||
|
Last updated: 10 April 2008 |