Library built with 7.xx causes warning message in 8.xx or later
Technical Note 20171003
Architectures:
Arm
Component:
linker
Updated:
10/3/2017 2:48 PM
Introduction
Because both the size and the internal encoding of wchar_t
are different between IAR Embedded Workbench for Arm version 7.xx and version 8.xx or later, the linker message
Warning [Lt009]: Inconsistent wchar_t size
will be generated when a library built with version 7.xx is used in version 8.xx or later.
Discussion
In IAR Embedded Workbench for Arm version 7.80 and earlier, the size of wchar_t
was two bytes and in version 8.11 the size of wchar_t
is four bytes. Moreover the internal encoding of wchar_t
objects between these versions objects is different.
This means that combining object files built with versions 7.80 and 8.xx or later will generate a linker warning if the application uses wchar_t
, the behavior will be unpredictable.
In general, we strongly recommend using object code from one version only, and for a major upgrade such as 7.xx to 8.xx or later, all code should be rebuilt.
If you choose to not to rebuilt, you should at least do following actions:
- a) Rebuild object code built with version 7.xx and written in C++.
- b) If the library does include
wchar_t
, rebuild the library with version 8.11 or later. - c) If a library built with version 7.xx does not include
wchar_t
, and an application built with version 8.xx (or later) in fact works as expected, you might want to ignore the warning message.
To suppress the warning message, do this:- Choose Project>Options>Linker>Diagnostics
- Select Suppress these diagnostics and specify:
Lt009
- Click OK.
Note:
If you later add another 7.xx library to your 8.11 (or later) project, please remove the suppress diagnostic option described above (“Lt009
”) and go through steps a-c again.
Conclusion
A library that uses wchar_t
built with IAR Embedded Workbench for Arm version 7.xx must be rebuilt to be used with version 8.xx or later.
All product names are trademarks or registered trademarks of their respective owners.