-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicitly export buffer<char> for MSVC #3132
Conversation
Some MSVC-specific behavior: Class ostream by inheriting detail::buffer<char> implicitly exports it when fmt is built as a shared library. Unless os.h is included, the compiler assumes detail::buffer<char> is not externally exported and instantiets a local copy of it, which cases ODR violation.
So the scenario to trigger the ODR violation is a bit untrivial and gets reproduced only by MSVC, but still:
C++17 is used on all platforms.
NOTE: there is a workaround: include This is the result running on current release 9.1.0. |
What I didn't do (and something that might be affected) - I didn't run the performance testing. Is there any automated tools/scripts to check the performance before/after the change? |
Not automated but there are some benchmarks in https://github.com/fmtlib/format-benchmark. They might need a bit of an update. |
It just came to my mind, but I think the alternative to this fix would be to aggregate |
#3139 looks like a better workaround, let's go with it. |
Some MSVC-specific behavior:
Class ostream by inheriting detail::buffer implicitly exports it when fmt is built as a shared library. Unless os.h is included, the compiler assumes detail::buffer is not externally exported and instantiets a local copy of it, which causes ODR violation.