In scenarios like Digital Content Creation (DCC) tools (e.g., Nuke or Katana), you may need to link a custom plugin against a different version of OpenEXR than the one used by the host application. To prevent symbol clashes, use the following strategies:
1. Namespace Options
Configure your custom build of OpenEXR with a unique namespace so its symbols do not collide with the host's symbols.
2. Handling OpenEXRCore (C API)
Because OpenEXRCore is implemented in C and does not support a namespace option, you must use a specific CMake flag to hide its symbols. This prevents the OpenEXRCore symbols in your plugin from clashing with the host's symbols.
Requirement: Build your custom OpenEXR library with:
-DOPENEXR_FORCE_EMBEDDED_CORE=ON
Effect: This links against a statically-built OpenEXRCore library with hidden symbols. Note that the installation will not include a libOpenEXRCore.so file.
Limitation: This solution works if your plugin uses the OpenEXR C++ API. If your plugin requires direct access to the OpenEXR C API from OpenEXRCore, this method will not work, and you must use other symbol-hiding mechanisms.
-DOPENEXR_FORCE_EMBEDDED_CORE=ON