Solved

Why build success when lib linked and lib files compiled ?

Posted on 2014-02-24
4
701 Views
Last Modified: 2014-02-24
I'm using Keil uVision version 4.73.  In my Options for Target I select RTX Kernel Operating System.  This selection will add following to the Linker Control String in the Linker Tab:

C:\Keil\ARM\RV31\LIB\RTX_ARM_L.LIB
This means this operating system library will be linked when I build my project.  In addition to linking this library, I have added all files used to create this library to my project as follows:

rt_Event.c
HAL_ARM.c
...

These files are in  C:\Keil\ARM\RL\RTX\SRC\ARM  folder.

Why does my build work ?   I'm including same Operating System twice.  Shouldn't I get re-defined symbols ?
0
Comment
Question by:naseeam
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 39884343
When you have all these files in your project, there are no dependancies to resolve. A linker will only use these functions from a static library that are referenced from your code, Since there are none, the linker will not look for them in the lib file.
0
 

Author Comment

by:naseeam
ID: 39884398
>> there are no dependencies to resolve
I want to make sure I understand.  If I call foo ( ) from my code, and foo is implemented in one of the project files, then, foo implementation from my project file will be part of executeable.  Identical Foo implementation from library file will be ignored ?
0
 
LVL 86

Expert Comment

by:jkr
ID: 39884563
Yes, that's exactly it. Code from static libraries will only be used on a 'as needed' basis. Never will the entire library be added to your executable (well unles really all functions are used).
0
 

Author Closing Comment

by:naseeam
ID: 39884606
Very Fast and useful response.  Great explanation of follow-up question.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now