C++ Logo

std-proposals

Advanced search

Re: [std-proposals] ABI

From: Hans <hguijtra_at_[hidden]>
Date: Fri, 12 Jul 2024 12:47:12 +0200
On 11/07/2024 22:28, Tiago Freire wrote:
> If you are talking about "static libraries", a library produced by a particular compiler vendor can not be linked with a different compiler vendor.
> The file formats are not the same, the concepts they use differ, they just don't talk the same language. Even libraries produced by the same compiler vendor on different versions are not even guaranteed to work.

This is incorrect: static library formats are well-defined, and you can
cross-link between compilers (at least, on the same platform).

> Dynamic libraries have a similar problem, if two compiler vendors can not agree on an implementation to use (not to mention name mangling rules), how do you expect them to agree on adopting a consistent numerical definition that describes the particular implementation adopted?

This is also incorrect: dynamic library formats are also well-defined,
and you can open libraries from different compilers and different
languages (again, on the same platform).

We have extern "C" to disable name mangling, but that's a choice by the
library author. Library authors that care about interoperability with
other languages will want to disable name mangling and not throw any
exceptions, but this is not part of the proposal.

> I personally think that concerns of breaking ABI are often unwarranted, and that the committee is being overly conservative about not breaking ABI, and that this is holding the language back!

So do I, but we're not in charge. My proposal is my next best choice.

I have personally had to deal with binary-only libraries using unstable
classes in public interfaces multiple times. Each time it was dramatic,
getting vendors to upgrade their compilers (and undoubtedly causing
grief to their other customers in the process). We need a better solution.


Hans Guijt

Received on 2024-07-12 10:47:15