问题
It is my understanding that (with the notable exception of the switch from VS2015 to VS2017) Microsoft makes ABI breaking changes between each version of the Visual C++ toolchain. So if I want to distribute a binary version of a library, I have to distribute a separate version of that for each new version of VS that I want to support.
Now my questions are:
- Is this is also true for pure c-libraries?
- Does the answer differ between dlls and static libraries?
- Is there an official policy from MS on what they aim for in the future?
(in particular in light of the refactoring and stabilization of the crt)
If this is relevant I'd be content with an answer specific to Win10 but I'm also interested in all windows versions since (and including) Win7. Versions of VS Studio that are of interest to me are VS2013/15/17 and - as far as any predictions can be made - future releases.
回答1:
The ABI of pure C is surely stable. You can mix DLLs made with different VisualStudio version, as long as you also have the correct MSVCRT* dependencies (this does not apply if you build them with static libc obviously).
However you have to take special care in passing pointer around (see http://siomsystems.com/mixing-visual-studio-versions/ and also Library ABI compatibility between versions of Visual Studio)
来源:https://stackoverflow.com/questions/41975672/abi-compatibility-of-visual-studio-c-libraries