1

If I build a DLL from a set of C++ headers and sources using MSVC, and generate an import library for the DLL, does that import library represent the ABI for the DLL? More specifically:

  • If I make a non-ABI affecting change to the sources and rebuild the DLL, is the newly generated import library always equivalent (mod metadata like timestamps) to the prior import library?
  • If I make an ABI affecting change to the sources and rebuild the DLL, is the newly generated import library always distinct (again, mod metadata) from the previously generated import library?

In other words, can I use the contents of the import library to reliably detect changes, or lack thereof, to the ABI of a DLL? Or are there ABI affecting changes I might make that could result in the same import library content, or non-ABI affecting changes I might make that could result in distinct import library content?

5
  • Not exactly. Name decoration helps to detect gross mismatches, especially so C++ name mangling and __stdcall decoration. But it is limited. The gritty stuff that causes hard to diagnose bugs, like sharing the same runtime libraries and memory allocators and exact matches on C++ object layout is not covered. Commented Apr 21, 2017 at 14:35
  • @HansPassant - Thanks for the comment. What about in a narrower scope? One C++ project where all sources are being compiled with consistent flags, runtimes, allocators, etc.
    – acm
    Commented Apr 21, 2017 at 20:35
  • That's what you need to do to take care of the gritty stuff. Which generally solves all problems. Commented Apr 21, 2017 at 20:38
  • @HansPassant - It sure does simplify things :) The reason I'm asking all of this is that I'm curious whether it would be possible to elide re-links this way. Consider a.{dll|imp} and b.dll which depends at build time on a.imp and at runtime on a.dll. If a change to the sources comprising a.dll results in an equivalent a.imp but different a.dll, within the scope of one consistently built project, it seems like a build system that used content signatures (say, SCons), could see that the a.imp was unchanged, even though a.dll was, and avoid relinking b.dll, to great rejoicing. Mod timestamps.
    – acm
    Commented Apr 21, 2017 at 21:35
  • Hmya, I generally post an answer to real questions and a comment to "what the heck is this really about" questions. You'll have to elevate this to a real question instead of a comment and SO users tend to appreciate the effort and return the favor. No point in making this convoluted. Commented Apr 21, 2017 at 21:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.