I created a library fuction having two fuction inside 1) Loop1() 2) Loop2() when i will call the only one fucnction still the copiler will add the code for both, below i am writing the content of the library file
#pragma SAVE #pragma REGPARMS extern void Loop1(void); extern void Loop2(void); #pragma RESTORE
void Loop1() { unsigned int i=0; while(i) { i--; }
}
void Loop2() { unsigned char i=0; while(i) { i--; } how can i avoid this problem
void main() { Loop1(); Loop2(); while(1);
http://www.keil.com/support/docs/2182.htm
Jon
Hi Jon If I am using Flaoting point division compiler automatically include the C51FPL,is there any way to do the library file which will be called if and if the fuctions related to that library is called.
is there any way to do the library file which will be called if and if the fuctions related to that library is called.
did you read the link Jon posted?
the answer is there
Erik
It means if i am having 10 different functions i have to create 10 different library right?
maybe, that depends on what you mean by "different library"
you need to generate 10 different modules (source files) but they can all go into the same library
here is a commandline example for generating a library with several modules
if not exist amk.lib goto usliex del amk.lib :usliex c:\tools\keil\c51\bin\lib51 c amk.lib >..\trash\trashbin c:\tools\keil\c51\bin\lib51 a MKmain.obj to amk.lib >..\trash\trashbin c:\tools\keil\c51\bin\lib51 a MKutil.obj to amk.lib >..\trash\trashbin c:\tools\keil\c51\bin\lib51 a MKj1708.obj to amk.lib >..\trash\trashbin c:\tools\keil\c51\bin\lib51 a MKkbpr.obj to amk.lib >..\trash\trashbin
if you insist on doing it in the so called IDE, you will need to wait for someone else, I can not use that limited a tool.
No. It means you will have 10 different source files. All of the object modules (there will be 10 of them) generated by the compiler for the source files will be included in the library. This is what the knowledgebase article says.
Version 8 of the C51 tools includes a lovely new LX51 linker option, REMOVEUNUSED, to remove "dead" (uncalled) code. This helps mitigate this problem to a large extent. You no longer have to break up every .c file into one file per function.
We have run into occasional bugs with this feature when the linker removes some but not all of the dead code, and we get "unresolved external" type warnings. I think this has something to do with inter-bank calls that turn out to be dead code, but we haven't really narrowed it down yet.
"Version 8 of the C51 tools includes a lovely new LX51 linker option, REMOVEUNUSED, to remove "dead" (uncalled) code. This helps mitigate this problem to a large extent."
Err... doesn't that defeat the entire object of a Library?
View all questions in Keil forum