SPRUI03E June 2015 – January 2023
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_64plus_be.lib | -mv6400+ --endian=big |
mylib_64plus_le.lib | -mv6400+ --endian=little |
mylib_6740_le.lib | -mv6740 --endian=little |
mylib_6600_be.lib | -mv6600 --endian=big |
Using the library information archiver, you can create an index library called mylib.lib from the above libraries:
libinfo6x --output mylib.lib mylib_6600_be.lib mylib_6600_le.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.
cl6x -mv64plus --endian=little --issue_remarks main.c -z -l lnk.cmd ./mylib.lib
<Linking>
remark: linking in "mylib_64plus_le.lib" in place of "mylib.lib"
cl6x -mv6600 --endian=big --issue_remarks main.c -z -l lnk.cmd ./mylib.lib
<Linking>
remark: linking in "mylib_6600_be.lib" in place of "mylib.lib"