We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Dear All,
I created a serial.lib file with four functions, and added to new project . in main i called only 2 function which is present in lib file. so its giving me an warning "*** WARNING L16: UNCALLED FUNCTION, IGNORED FOR OVERLAY PROCESS" this is because of other 2 function which is not called in main.
how to clear this warning...
Thanks & regards Kiran Kumar D
Did you put all 4 functions into a single source file?
For the Linker to be able to pick individual functions from a Library, I think they have to be loaded into the library as separate objects...?
yes all functions in a single file and seperate objects
all functions in a single file and seperate objects one file generates one object.
The linker can not include 1/4 of an object file and thus if one function in an object in a library is needed all functions in that object get linked in.
Instead of making your library from one file with 4 functions make it from 4 files with one function each .
Erik
uvision do not have a smart linker :( and best as every function in seporate file
uvision do not have a smart linker :(
One of the linkers (I do not rely on tools, I write stuff that works - and, thus, do not recall which one) can remove unused functions.
It's smart enough - but you have to structure your project appropriately.
Motto for today: Know your tools!
http://www.keil.com/support/man/docs/lx51/lx51_removeunused.htm
Most are not. They just include the unused code quietly. Since Keil for the 8052 overlays, it can not just ignore unused functions. It can not know if they are call via a pointer.
All 4 functions are in a single file. and compiled to generate lib file. and i added this lib file to project.
All functions are placed in a single file. how to create diff'nt objects
then how standard lib like stdio,conio are created with all functions in a single lib.
if i make each function with different files, then there will be huge number of files.
how can i manage like default library.
Yes, real libraries are built from a huge number of source files, to get a high granularity.
That has been the standard behaviour for almost all language tools since beginning of time. Most architectures don't have object file formats that supports cutting/pasting of individual symbols during the linking. Most tools are completely silent about unused symbols being added - some allows it to be seen in the generated map file.
"then how standard lib like stdio,conio are created with all functions in a single lib."
One source file for each function - as stated.
"if i make each function with different files, then there will be huge number of files."
Only if you have a "huge" number of functions in your library!
You said that you have 4 functions - so 4 source files is hardly a "huge" number, is it?!
There is still only one library file.
"how can i manage like default library."
Surprisingly enough, by using the Library Manager:
http://www.keil.com/support/man/docs/lib51/ http://www.keil.com/support/man/docs/libx51/