None of the other answers (yet) mention an important function that facilitates the interworking between compilers and libraries - ABI or Application Binary Interface. On Unix-like machines, there is a well-documented ABI, and the C compilers in the system all follow the ABI. This allows a lot of mix. Usually you use the C system library, but you can use the replaceable version provided by the compiler, or created separately. And, as a rule, you can use a library compiled by one compiler with programs compiled by other compilers.
Sometimes a single compiler uses the runtime support library for some operations - perhaps 64-bit arithmetic routines on a 32-bit machine. If you use a library built with this compiler as part of a program created with another compiler, you may need to link this library. However, I have not seen this as a problem for a long time - with pure C.
C ++ binding is another matter. The same degree of interaction is not observed between different C ++ compilers - they do not agree with the details of the class layout (vtables, etc.), as well as how the exception handling is performed, etc. You need to work harder to create libraries created with one C ++ compiler that others can use.
source share