Ticket #113 (closed defect: fixed)
symbol clashes
Reported by: | jasper | Owned by: | jasper |
---|---|---|---|
Priority: | major | Milestone: | Maintenance of Phase II |
Component: | Demo PPM | Version: | 1.2.0.9 |
Keywords: | Cc: |
Description
On linux, a dynamic linker will only take into account public symbols once. So a symbol clash between two shared software components will cause the dynamic linker to mistake the functions of one for the other.
This has now been observed, without mitigation, the class "PropertyPackage?" in the test suite clashes with the class "PropertyPackage?" in the WaterPP, both of which export ICapeIdentification with identical symbol names. To the effect of the linker putting only one of them in the symbol table at runtime, and member functions of one class are invoked only, even if the other class is used. Which naturally leads to undefined behaviour (crash).
To mitigate, all components should by default hide their symbols from the dynamic linker, or alternatively use a namespace that is unique in the world. The former is the easier solution, and is obtained in CMake via this option
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
Only the class factories need to be public, which is done automatically by COBIA's definition for COBIA_EXPORT:
#define COBIAEXPORT __attribute__((visibility("default")))
COBIA itself already hid its symbols.
Fixed in revision 253 for COBIA Phase II
Fixed in revision 254 for COBIA Phase III