Binary Comptability Flashcards
What is binary compatibility?
A program using the older version of a header file continues to work with the newer versions of the header.
What is source compatibility?
A program works when recompiled but not modifications to the source code are required.
What is a programs API?
Application Programming Interface: The functions, classes, types, etc, that are publicly defined in source code that components outside the program cant use.
What does the application Binary interface do?
The same thing as an API but at a binary level.
- The binary interface between two components
- Defines how data structures and routines are accessed in machine code
- The outcome of the compilation process
What is binary compatibility in terms of ABI?
Keeping the ABI consistent between builds of your program/library
What can you do in order to be binary compatibile?
- Add new non-virtual functions
- Add new Enums
- Reimplement an existing virtual function.
- Add static members
What cannot you do if you want to be binary comptabile?
- Change existing function/class member signatures
- Add a virtual function to a class without any, or add a virtual function a parent virtual class
- Change the order of virtual functions.
- Change template arguments
What is the PImpI idiom?
An approach in which header files store the public API for our class.
A separate implementation-only class handled inner details. The API class stores a Pointer to this separate private implementation.
What is the aim of PImpl?
To create a public API for your class that can be consistently defined in its header file.
Why do PImpl?
To avoid large recompilation especially for larger projects.