Break ABI to save C++
===
## ABI generation
## Moving to Modern C++
跟 Modern C++ 比較有關的 ABI issue
## Safe methods
肯定安全不會造成 ABI silent corruption 的幾種情況:
1. Add new **non-virtual** function in class
2. Add new **enums** in class
3. Append **new enumerators**, but ==not== change the underlying type.
4. Define an inline function out of line
5. Change static data member(s)
6. Add new classes
7. Add/remove friend functions
:::danger
其他都很有可能造成 ABI 不一致
:::
## Suggestions
最輕量的方式:**包裝 C 語言 Interface**在外層
接觸「對上對下」的邏輯地方
shared-engine 內部滾動更新 ABI, compiler, lib, etc ...
:::spoiler
buggy issue:
library 每版大概還是修復百餘個 bug...
讓每件事情,符合預期
:::
## Using tools to probe your ABI
1. abigail
2. c++filt
3. nm
## References
1. https://itanium-cxx-abi.github.io/cxx-abi/abi.html
2. https://www.youtube.com/watch?v=By7b19YIv8Q
3. https://viruta.org/rust-stable-abi.html
4. https://cor3ntin.github.io/posts/abi/
5. https://community.kde.org/Policies/Binary_Compatibility_Issues_With_C%2B%2B
6. https://youtu.be/DZ93lP1I7wU?t=1733