This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Static Library in keil

I have the ready-to-use code bundle for the controller i use. It came along with the development board.

The question is, should i create a *.lib file (with all the source files added to it)?
will it reduce the size of code as compared to adding all the source files?

kindly note that, I dont know how create a *.lib file in keil. will read the documents available on keil.
but m cautious about investing time if it does not have any specific advantage.

Parents
  • Some compilers can automatically (possibly after getting a specific compiler flag) place the functions of a source file into separate regions, to allow the linker to cherry-pick at a much finer level than than grabbing complete object files.

    An example for gcc:
    elinux.org/Function_sections

    That makes it much easier with the source code management of libraries - it's no fun to move each individual function into a separate source file. Extra extreme to have a C++ class where each member methods has to be placed into separate source files just so the linker can include just the member methods that are actually used by the program.

    On the other hand - Keils 8051 compiler can perform code optimization during the actual linking, which is quite uncommon.
    http://www.keil.com/support/docs/2297.htm

    So architecture and selected tools can make a huge difference in what is the correct answer to a question.

Reply
  • Some compilers can automatically (possibly after getting a specific compiler flag) place the functions of a source file into separate regions, to allow the linker to cherry-pick at a much finer level than than grabbing complete object files.

    An example for gcc:
    elinux.org/Function_sections

    That makes it much easier with the source code management of libraries - it's no fun to move each individual function into a separate source file. Extra extreme to have a C++ class where each member methods has to be placed into separate source files just so the linker can include just the member methods that are actually used by the program.

    On the other hand - Keils 8051 compiler can perform code optimization during the actual linking, which is quite uncommon.
    http://www.keil.com/support/docs/2297.htm

    So architecture and selected tools can make a huge difference in what is the correct answer to a question.

Children
No data