ARM Technical Support Knowledge Articles

HOW TO STRUCTURE MODULES IN A LIBRARY

Applies to: General Topics

Answer


Information in this article applies to:


SYMPTOMS

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?

CAUSE

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.

RESOLUTION

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.

SEE ALSO

Article last edited on: 2006-12-21 02:28:13

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential