Scenario:
Shared library uses {fmt} in header-only mode.
An application uses the library, and uses {fmt} in embedded non-header mode, i.e. the file format.cc
is compiled and linked into the binary.
The library and the application don't necessarily use the same version of {fmt} (could f.ex. be 10.0.0 vs 10.1.0).
Is there a danger of violating the One Definition Rule here? Will {fmt} symbols in library leak into application/be visible when linking application?
If yes, is the problem:
- mixing header-only and embedded?
- mixing versions?
- both?
It might, yes.
Depends on how careful your library is. Your library should probably not export and hide those symbols. How to do that is going to depend on your compiler/OS.
Yes, both. But if your library is careful to not export those symbols, you should generally be fine.