SLAU131V October 2004 – February 2020
Consider these object file libraries that all have the same members, but are built with different build options:
Object File Library Name | Build Options |
---|---|
mylib_msp_small.lib | --silicon_version=msp |
mylib_mspx_small.lib | --silicon_version=mspx –data_model=small |
mylib_mspx_restricted.lib | --silicon_version=mspx –data_model=restricted |
mylib_mspx_large_eh.lib | --silicon_version=mspx –data_model=large --exceptions |
Using the library information archiver, you can create an index library called mylib.lib from the above libraries:
libinfo430 --output mylib.lib mylib_msp_small.lib mylib_mspx_small.lib
mylib_mspx_restricted.lib mylib_mspx_large.lib
You can now specify mylib.lib as a library for the linker of an application. The linker uses the index library to choose the appropriate version of the library to use. If the --issue_remarks option is specified before the --run_linker option, the linker reports which library was chosen.
cl430 -silicon_version=mspx -data_model=restricted --issue_remarks main.c -z -l lnk.cmd
./mylib.lib
<Linking>
remark: linking in "mylib_mspx_restricted.lib" in place of "mylib.lib"
cl430 -silicon_version=mspx -data_model=large --issue_remarks main.c -z -l lnk.cmd ./mylib.lib
Linking>
remark: linking in "mylib_mspx_large_eh.lib" in place of "mylib.lib"
In Example 2, a library with exception handling is linked in, since there is no large data model library without exception handling.