naseeam
asked on
Why build success when lib linked and lib files compiled ?
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_A RM_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 ?
C:\Keil\ARM\RV31\LIB\RTX_A
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
Why does my build work ? I'm including same Operating System twice. Shouldn't I get re-defined symbols ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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).
ASKER
Very Fast and useful response. Great explanation of follow-up question.
ASKER
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 ?