ARM Technical Support Knowledge Articles

MAKING YOUR OWN LIBRARY FILES

Applies to: General Topics

Answer


Information in this article applies to:


SYMPTOMS

I generated a library file (.lib) using the library manager and expected that if I compiled an independent source file and linked it with the library, the linker would take care of only pulling in the functions that were referenced. However, the linker is including all functions in each module from the library and I'm getting linker warnings about these uncalled functions.

CAUSE

Libraries are composed of object modules (which are composed of variables and functions). The smallest unit the linker can manipulate is an object module. So, when you reference a function from a library, the linker includes the entire object module that contains that function. This is only a problem when one object module in your library contains more than one function.

RESOLUTION

The only way to solve this problem is to build your library with one function per source file. Then, when the linker includes a segment from the library, only one function is included. This is the way that most professional libraries are created.

Article last edited on: 2005-02-05 14:51:12

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