 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Al Stevens Guest
|
Posted: Tue Dec 09, 2003 7:59 pm Post subject: ABI? |
|
|
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! ]
|
|
| Back to top |
|
 |
Alberto L Guest
|
|
| Back to top |
|
 |
Hyman Rosen Guest
|
Posted: Tue Dec 09, 2003 10:09 pm Post subject: Re: ABI? |
|
|
Al Stevens wrote:
| Quote: | 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.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Stefan Heinzmann Guest
|
Posted: Wed Dec 10, 2003 11:13 am Post subject: Re: ABI? |
|
|
Al Stevens wrote:
| Quote: | I must ask a dumb question here.
|
I don't think it is dumb at all.
| Quote: | 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 :-)
| Quote: | 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Al Stevens Guest
|
Posted: Wed Dec 10, 2003 11:14 am Post subject: Re: ABI? |
|
|
"Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote
| Quote: | Al Stevens wrote:
ABI, what does it mean?
Application Binary Interface
[snip] |
| Quote: | 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Tnwmack Guest
|
|
| Back to top |
|
 |
Thorsten Ottosen Guest
|
Posted: Wed Dec 10, 2003 11:37 am Post subject: Re: ABI? |
|
|
"Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote
| Quote: | 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Jean-Marc Bourguet Guest
|
Posted: Wed Dec 10, 2003 4:09 pm Post subject: Re: ABI? |
|
|
"Al Stevens" <nobody (AT) home (DOT) com> writes:
| Quote: | "Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote in message
news:1071003495.1185 (AT) master (DOT) 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Francis Glassborow Guest
|
Posted: Wed Dec 10, 2003 4:23 pm Post subject: Re: ABI? |
|
|
In article <aZrBb.58939$AM3.1084818 (AT) twister (DOT) tampabay.rr.com>, Al Stevens
<nobody (AT) home (DOT) com> writes
| Quote: | "Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote in message
news:1071003495.1185 (AT) master (DOT) 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Antoun Kanawati Guest
|
Posted: Wed Dec 10, 2003 8:15 pm Post subject: Re: ABI? |
|
|
Al Stevens wrote:
| Quote: | "Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote in message
news:1071003495.1185 (AT) master (DOT) 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.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Al Stevens Guest
|
Posted: Wed Dec 10, 2003 8:23 pm Post subject: Re: ABI? |
|
|
"Francis Glassborow" <francis (AT) robinton (DOT) demon.co.uk> wrote
| Quote: | 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Ben Hutchings Guest
|
Posted: Wed Dec 10, 2003 8:30 pm Post subject: Re: ABI? |
|
|
Al Stevens wrote:
| Quote: |
"Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote in message
news:1071003495.1185 (AT) master (DOT) 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.
| Quote: | 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.
| Quote: | 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.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Hyman Rosen Guest
|
Posted: Wed Dec 10, 2003 8:36 pm Post subject: Re: ABI? |
|
|
Al Stevens wrote:
| Quote: | 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.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Mogens Hansen Guest
|
Posted: Thu Dec 11, 2003 11:40 am Post subject: Re: ABI? |
|
|
"Thorsten Ottosen" <nesotto (AT) cs (DOT) auc.dk> wrote
| Quote: | "Hyman Rosen" <hyrosen (AT) mail (DOT) com> wrote in message
news:1071003495.1185 (AT) master (DOT) 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
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Derek Guest
|
Posted: Thu Dec 11, 2003 12:28 pm Post subject: Re: ABI? |
|
|
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...
| Quote: |
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}
Cheers Stefan
|
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|