Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ABI?

149 views
Skip to first unread message

Al Stevens

unread,
Dec 9, 2003, 2:59:04 PM12/9/03
to
I must ask a dumb question here. I've been away from C++ for a while. In
recent readings, the acronym ABI popped up. A google search turns it up all
over the place, but never defined anywhere and never in a context where I
can infer exactly what it means. The acronym is not mentioned in my PDF copy
of the standard. Anyway, what does it mean?

Al Stevens
http://www.alstevens.com


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Alberto L

unread,
Dec 9, 2003, 5:09:03 PM12/9/03
to
Hi,

see http://gcc.gnu.org/ml/libstdc++/2001-11/msg00063.html

{However could everyone please avoid posting just a URI, a sentence
explaining why it is relevant is helpful. -mod}

Hyman Rosen

unread,
Dec 9, 2003, 5:09:25 PM12/9/03
to
Al Stevens wrote:
> ABI, what does it mean?

Application Binary Interface

In this context, it is an exhaustively detailed specification for
how C++ structures are represented when compiled. This includes
the layout of classes in memory, the layout of virtual tables, the
format of exception hander information, the modification of vtable
pointers during construction and destruction, parameter passing and
return sequences, and detailed name mangling rules, including rules
for mangling compiler-genertated entities such as the guards which
ensure that static initializers run exactly once.

Compilers which adhere to an ABI produce object files which can be
linked with object files from other adherent compilers.

Stefan Heinzmann

unread,
Dec 10, 2003, 6:13:57 AM12/10/03
to
Al Stevens wrote:
> I must ask a dumb question here.

I don't think it is dumb at all.

> I've been away from C++ for a while. In
> recent readings, the acronym ABI popped up.

The acronym is quite old. You must have been away for a long while :-)

> A google search turns it up all
> over the place, but never defined anywhere and never in a context where I
> can infer exactly what it means. The acronym is not mentioned in my PDF copy
> of the standard. Anyway, what does it mean?

It isn't defined in the C++ standard because the standard is not
concerned with binary representations of C++ constructs.

ABI means Application Binary Interface

In prose, an ABI defines what is needed to interface the compiled code
of an application to the compiled code of a library. In C times this
meant to define the procedure call details (how parameters are passed
and results returned), the representation of data types (how elementary
types are stored, i.e. alignment, and the memory image of structs), and
how names in the source code translate to names for the linker (i.e.
some C compilers prepend an underscore to procedure names, some don't).

In C++ there are more things to specify to ensure that applications can
be linked to libraries: How is the virtual function call mechanism
implemented (layout of the vtable, multiple inheritance etc.). What is
the object layout in memory (this goes beyond simple structs: i.e.
there's virtual and multiple inheritance to consider). How are
exceptions handled (this includes the whole stack unwinding business).
How is run-time-type-info represented (and, as a consequence, how does
dynamic_cast work). There may be more things I overlooked.

If two compilers for the same platform implement the above language
features differently (and that is frequently the case), an application
can not be linked successfully to a library that was compiled with the
other compiler. This is particularly painful with shared libraries (or
DLLs, however you name them).

An ABI standard is meant to remove this complication. It is by
definition platform specific (it doesn't make any sense to link an
application compiled for a Mac to a library compiled for a Sun, for
instance). It is meant to make different compilers on the same platform
compatible to each other (so that you can link an application compiled
with GCC with a library compiled with the Sun compiler, for instance).

Without an ABI, a library vendor not wanting to distribute the library
source code is faced with the problem of having to provide not just one
version of the library per platform but one version per compiler on each
of the supported platforms. This is very quickly getting unmanageable
and presents a serious obstacle for library vendors.

Cheers
Stefan

Al Stevens

unread,
Dec 10, 2003, 6:14:40 AM12/10/03
to

"Hyman Rosen" <hyr...@mail.com> wrote in message
news:1071003...@master.nyc.kbcfp.com...

> Al Stevens wrote:
> > ABI, what does it mean?
>
> Application Binary Interface
>
[snip]

> Compilers which adhere to an ABI produce object files which can be
> linked with object files from other adherent compilers.

Thank you. Is this a Linux-only thing? Or has the C++ compiler community at
large embraced it? Is it likely to be a part of the standard?

Al Stevens
http://www.alstevens.com

Tnwmack

unread,
Dec 10, 2003, 6:34:59 AM12/10/03
to
You should try out Google glossary http://labs.google.com/glossary it works
really well for stuff like that.

It came up with: Application binary interface


Tweek

Thorsten Ottosen

unread,
Dec 10, 2003, 6:37:27 AM12/10/03
to
"Hyman Rosen" <hyr...@mail.com> wrote in message
news:1071003...@master.nyc.kbcfp.com...
> Al Stevens wrote:

> Compilers which adhere to an ABI produce object files which can be
> linked with object files from other adherent compilers.

And how many compilers currently support the same ABI?

-Thorsten

Jean-Marc Bourguet

unread,
Dec 10, 2003, 11:09:15 AM12/10/03
to
"Al Stevens" <nob...@home.com> writes:

> "Hyman Rosen" <hyr...@mail.com> wrote in message
> news:1071003...@master.nyc.kbcfp.com...
> > Al Stevens wrote:
> > > ABI, what does it mean?
> >
> > Application Binary Interface
> >
> [snip]
>
> > Compilers which adhere to an ABI produce object files which can
> > be linked with object files from other adherent compilers.
>
> Thank you. Is this a Linux-only thing? Or has the C++ compiler
> community at large embraced it? Is it likely to be a part of the
> standard?

By definition, an ABI specify things which are architecture and
sometimes operating system specific.

As far as I know, there has been one definition of a common ABI for
IA-64 which is endorsed by most if not all producers of compilers for
IA-64 (and most probably most OS builders are trying not to interfere
with this ABI) and gcc use now the architecture independant part of
that ABI for most (if not all) its targets.

I know of no other tentative to create and publish an ABI for C++
which is common to several compiler producers.

Yours,

--
Jean-Marc

Francis Glassborow

unread,
Dec 10, 2003, 11:23:44 AM12/10/03
to
In article <aZrBb.58939$AM3.1...@twister.tampabay.rr.com>, Al Stevens
<nob...@home.com> writes

>"Hyman Rosen" <hyr...@mail.com> wrote in message
>news:1071003...@master.nyc.kbcfp.com...
> > Al Stevens wrote:
> > > ABI, what does it mean?
> >
> > Application Binary Interface
> >
>[snip]
>
> > Compilers which adhere to an ABI produce object files which can be
> > linked with object files from other adherent compilers.
>
>Thank you. Is this a Linux-only thing? Or has the C++ compiler community at
>large embraced it? Is it likely to be a part of the standard?

1) It is not a Linux only thing though ABIs are easier to provide on a
platform by platform basis.

2) An ABI is outside the scope of an ISO language standard because it
necessarily relies on things that are platform specific (such as
endianness)

--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit

Antoun Kanawati

unread,
Dec 10, 2003, 3:15:50 PM12/10/03
to
Al Stevens wrote:
> "Hyman Rosen" <hyr...@mail.com> wrote in message
> news:1071003...@master.nyc.kbcfp.com...
> > Al Stevens wrote:
> > > ABI, what does it mean?
> >
> > Application Binary Interface
> >
> [snip]
>
> > Compilers which adhere to an ABI produce object files which can be
> > linked with object files from other adherent compilers.
>
> Thank you. Is this a Linux-only thing? Or has the C++ compiler community at
> large embraced it? Is it likely to be a part of the standard?

It's not standard, since the standard does not specify the
representations, mangling, or any of the other details.

ABI (adherence, or lack thereof) usually comes up with
compiler upgrades.

Al Stevens

unread,
Dec 10, 2003, 3:23:15 PM12/10/03
to

"Francis Glassborow" <fra...@robinton.demon.co.uk> wrote in message
news:3OLc1sCcEy1$Ew...@robinton.demon.co.uk...

> 2) An ABI is outside the scope of an ISO language standard because it
> necessarily relies on things that are platform specific (such as
> endianness)

So does int. :-) My question wasn't meant to ask if any particular ABI would
become part of the standard; rather whether the ABI concept itself be
identified as something a compliant compiler ought to support. But I can see
where they wouldn't want to get into that can of worms. Thanks.

Al Stevens
http://www.alstevens.com

Ben Hutchings

unread,
Dec 10, 2003, 3:30:30 PM12/10/03
to
Al Stevens wrote:
>
> "Hyman Rosen" <hyr...@mail.com> wrote in message
> news:1071003...@master.nyc.kbcfp.com...
> > Al Stevens wrote:
> > > ABI, what does it mean?
> >
> > Application Binary Interface
> >
> [snip]
>
> > Compilers which adhere to an ABI produce object files which can be
> > linked with object files from other adherent compilers.
>
> Thank you. Is this a Linux-only thing?

No.

> Or has the C++ compiler community at large embraced it?

The standardisation of C++ ABIs started with the IA64 ABI which
is used by C++ implementations for Linux and proprietary Unixes on
Itanium processors. I don't think Microsoft follows it with VC++
for IA64 though.

ARM has subsequently drawn up a similar ABI for their architecture,
which is supported by most ARM tool vendors on a wide variety of
operating systems.

The GCC project has adopted ABIs based on the IA64 ABI for various
other architectures and operating systems. Again, GCC is used on
a wide variety of operating systems.

On Windows, however, Visual C++ is the de-facto standard and its
ABI is unpublished so it's difficult for other implementations to
interoperate with it. A subset of the ABI has been reverse-
engineered successfully and is supported by other implementations.

> Is it likely to be a part of the standard?

I don't think so. There have been C ABIs for a long time and they
have never been included in the standard.

Hyman Rosen

unread,
Dec 10, 2003, 3:36:14 PM12/10/03
to
Al Stevens wrote:
> Thank you. Is this a Linux-only thing? Or has the C++ compiler community at
> large embraced it? Is it likely to be a part of the standard?

By their nature, ABIs depend heavily on the architecture for which
they're defined, and must interact with existing operating system
infrastructure as well. The best you could hope for is that all
compilers on a platform will follow a standard for that platform.

It can never be part of the standard becaus ethe standard doesn't
specify low-level implementation details.

Also, as an example of problems that can occur, Microsoft has a patent
on a particular form of object layout they use in their C++ compiler,
so other vendors have made deliberately incompatible compilers so as to
avoid having to pay roaylties.

Mogens Hansen

unread,
Dec 11, 2003, 6:40:54 AM12/11/03
to

"Thorsten Ottosen" <nes...@cs.auc.dk> wrote in message
news:3fd6bcbf$0$1020$afc3...@news.optusnet.com.au...

> "Hyman Rosen" <hyr...@mail.com> wrote in message
> news:1071003...@master.nyc.kbcfp.com...
> > Al Stevens wrote:
>
> > Compilers which adhere to an ABI produce object files which can be
> > linked with object files from other adherent compilers.
>
> And how many compilers currently support the same ABI?

Examples:
Intel C++ for Windows supports the ABI of either
Microsoft Visual C++ V6.0
Microsoft Visual C++ V7.0 (.NET 2002) native code
Microsoft Visual C++ V7.1 (.NET 2001) native code
for x86 processors
in my experience that works fine in practice

Intel C++ for Linux supports the ABI of
g++ 3.2
for x86 and Itanium processors
I only have little experience with that in practice.

It's my impression that Itanium processor compilers are encorages to follow
the same ABI (http://www.codesourcery.com/cxx-abi/)

Kind regards

Mogens Hansen

Derek

unread,
Dec 11, 2003, 7:28:40 AM12/11/03
to
Good answer, Stefan. That's the best explanation of ABI that I have
seen yet.

It seems to me that for a standard C++ ABI to succeed, compiler
vendors would have to agree on many implementation details (data
layout and alignment, member pointers, vtable layout, RTTI, function
calling, mangling, exception handling, etc.). Agreement on so many
points seems unlikely. Can anyone tell me if a standard C++ ABI has
been adoped by on any platform?

"Stefan Heinzmann" wrote...


>
> > I must ask a dumb question here.
>
> I don't think it is dumb at all.
>
> > I've been away from C++ for a while. In recent
> > readings, the acronym ABI popped up.
>
> The acronym is quite old. You must have been away for
> a long while :-)
>
> > A google search turns it up all over the place,
> > but never defined anywhere and never in a context
> > where I can infer exactly what it means. The
> > acronym is not mentioned in my PDF copy of the
> > standard. Anyway, what does it mean?
>
> It isn't defined in the C++ standard because
> the standard is not concerned with binary
> representations of C++ constructs.
>
> ABI means Application Binary Interface
>

{quote of rest of post snipped by mod/fgw}

Francis Glassborow

unread,
Dec 11, 2003, 4:04:28 PM12/11/03
to
In article <br7tk6$drtt$1...@ID-46268.news.uni-berlin.de>, Derek
<no...@none.com> writes

>It seems to me that for a standard C++ ABI to succeed, compiler
>vendors would have to agree on many implementation details (data
>layout and alignment, member pointers, vtable layout, RTTI, function
>calling, mangling, exception handling, etc.). Agreement on so many
>points seems unlikely. Can anyone tell me if a standard C++ ABI has
>been adoped by on any platform?


And in there you have one of the key reasons why Standard C++ will, IMO,
always avoid saying anything about ABIs; vtables are an implementation
detail that is not even required by the Standard. To require them and
then specify their layout would, IMO, always be over-specification of a
general language standard.

--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit

Alf P. Steinbach

unread,
Dec 11, 2003, 4:06:54 PM12/11/03
to
[Please don't top-post, Derek; rearranged]

On 11 Dec 2003 07:28:40 -0500, "Derek" <no...@none.com> wrote:

> >
> > ABI means Application Binary Interface
> >
>{quote of rest of post snipped by mod/fgw}
> >

>Good answer, Stefan. That's the best explanation of ABI that I have


>seen yet.
>
>It seems to me that for a standard C++ ABI to succeed, compiler
>vendors would have to agree on many implementation details (data
>layout and alignment, member pointers, vtable layout, RTTI, function
>calling, mangling, exception handling, etc.). Agreement on so many
>points seems unlikely. Can anyone tell me if a standard C++ ABI has
>been adoped by on any platform?

Yes, COM on the Windows platform (and COM derivates such as the one used
in Mozilla, and Gnome Bonobo, amazingly implemented on top of Corba!).

One might argue that COM isn't a C++ ABI but a language-independent ABI.
But then one would be adopting some personal, very restricted definition
of ABI. COM has been very successful as an ABI, and was made for C++.

Now the thing about COM is that it doesn't define very much more than the
layout of vtables -- there are no member pointers, RTTI, mangling... The
one who defines an ABI is free to restrict the definition to sensible
things, and that's what was done with COM. Hence, it's not just a C++ ABI
but also to some extent a language-independent ABI, and the conclusion that
a C++ ABI would _have to_ define a lot of very C++-specific things is wrong.

ka...@gabi-soft.fr

unread,
Dec 12, 2003, 2:18:40 PM12/12/03
to
al...@start.no (Alf P. Steinbach) wrote in message
news:<3fd8649d....@News.CIS.DFN.DE>...

> [Please don't top-post, Derek; rearranged]

> On 11 Dec 2003 07:28:40 -0500, "Derek" <no...@none.com> wrote:

> > > ABI means Application Binary Interface

> {quote of rest of post snipped by mod/fgw}

> >Good answer, Stefan. That's the best explanation of ABI that I have
> >seen yet.

> >It seems to me that for a standard C++ ABI to succeed, compiler
> >vendors would have to agree on many implementation details (data
> >layout and alignment, member pointers, vtable layout, RTTI, function
> >calling, mangling, exception handling, etc.). Agreement on so many
> >points seems unlikely. Can anyone tell me if a standard C++ ABI has
> >been adoped by on any platform?

> Yes, COM on the Windows platform (and COM derivates such as the one
> used in Mozilla, and Gnome Bonobo, amazingly implemented on top of
> Corba!).

> One might argue that COM isn't a C++ ABI but a language-independent
> ABI. But then one would be adopting some personal, very restricted
> definition of ABI.

Why? There's nothing wrong with having a language-independant ABI. In
many ways, it's even more useful than having a C++ ABI. For that
matter, there's nothing wrong with having a platform independant ABI,
like Corba. That's even more useful. None of which means that having a
C++ ABI (platform specific) isn't useful as well.

> COM has been very successful as an ABI, and was made for C++.

> Now the thing about COM is that it doesn't define very much more than
> the layout of vtables -- there are no member pointers, RTTI,
> mangling...

I don't know enough about COM to really comment, but if I cannot pass a
pointer to a member function from one compilation unit to the next, it
isn't really a C++ ABI. At least for the definition of ABI being used
here.

> The one who defines an ABI is free to restrict the definition to
> sensible things, and that's what was done with COM.

It depends on what one claims to be defining. As far as I know, the
goal of COM was never to allow C++ modules compiled with different
compilers to link into a common executable, with all C++ features
supported. (I'm not sure, but I think its goal was to be a Microsoft
proprietory competitor to Corba. Which is something completely
different from what is being discussed here.)

> Hence, it's not just a C++ ABI but also to some extent a
> language-independent ABI, and the conclusion that a C++ ABI would
> _have to_ define a lot of very C++-specific things is wrong.

If it is to be a C++ ABI, and claim to seemlessly support linking of
modules compiled by different compilers, then it has to define a lot of
C++ specific things. And that's what is being talked about here, even
if that isn't the only meaning you can give to ABI.

--
James Kanze GABI Software mailto:ka...@gabi-soft.fr
Conseils en informatique orientée objet/ http://www.gabi-soft.fr
Beratung in objektorientierter Datenverarbeitung
11 rue de Rambouillet, 78460 Chevreuse, France, +33 (0)1 30 23 45 16

0 new messages