|ARM Technical Support Knowledge Articles|
Applies to: General Topics
Information in this article applies to:
I am trying to create a library of functions, but each time I include it in my applications all the functions in the same file are included even if I do not use them. How should I structure the modules in a library file?
A module (object file) is the smallest translation unit that contains variables, functions, and so on. When the linker extracts variables or functions from a library, the whole module is included (not just the function or variable you use). It is not possible for the linker to extract anything smaller than a module from a library file.
While is is not possible for the linker to break a module into smaller blocks, it is possible to do this when creating the source files.
Basically, when creating a library, you should place only one function in a source file. Since each module will contain only one function (or one function and its support variables and routines) additional unused functions will not be included by the linker.
Article last edited on: 2006-12-21 02:28:13
Did you find this article helpful? Yes No
How can we improve this article?