If in "normal" C, I define a global constant in one module:
const int iTabCount= 5;
and then use this constant in another module (module2.c) with extern:
extern const int iTabCount;
Then "normal" C will do this without any problems.
But in C++ files this fails, even if I encapsulate these definitions in extern "C" { ... };
If I use C++, in the first module, I get
warning #177-D: variable "iTabCount" was declared but never referenced
(This is correct, it is really not referenced in this module - but as this variable is NOT defined as static, there should be no problem ...).
And on linking I get the following error:
Error: L6218E: Undefined symbol iTabCount (referred from module2.c)
All works fine, if I remove the "const" qualifier. But I would like to keep it - especially for some larger const table, where it would be quite inefficient to reserve RW data space for such a code table.
I think this is some C++ compiler problem? Not possible to use const data over several modules in C++?