what are C++ABI;s | | |
what are ABI'sin C++
-Parag | | | | re: what are C++ABI;s
On May 14, 10:16*am, "parag_p...@hotmail.com" <parag_p...@hotmail.com>
wrote: Quote:
what are ABI'sin C++
-Parag
Do you mean this? http://en.wikipedia.org/wiki/Applica...nary_interface
They are at best peripheral to this news group, as they
are not part of the language standard. How the language
connects and communicates with the OS is not defined in
any great detail for C++.
Socks | | | | re: what are C++ABI;s
On May 14, 4:45 pm, Puppet_Sock <puppet_s...@hotmail.comwrote: Quote:
On May 14, 10:16 am, "parag_p...@hotmail.com" <parag_p...@hotmail.com>
wrote:
Quote: Quote:
what are ABI'sin C++
Quote:
They are at best peripheral to this news group, as they are
not part of the language standard. How the language connects
and communicates with the OS is not defined in any great
detail for C++.
They are and they aren't relevant to the newsgroup. There have
been efforts to define a portable ABI for C++, at least for
specific platforms. (I think there is one for the Itanium
architecture.) And it's a constant source of discussion: why
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)? In many ways, it's a
serious problem with C++ that the question doesn't have any
answers which would be really relevant here: that if I have a
third party library which I have to use, and it is compiled with
Sun CC, I can't use g++. (See the thread on binary
compatility.) It's an issue which all C++ programmers face at
one time or another.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 | | | | re: what are C++ABI;s
James Kanze wrote: Quote:
And it's a constant source of discussion: why
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)?
A standardized ABI would allow even more than that. For example, it
would allow linking object files created by compilers of different
languages into the binary (such as for example object files created by a
pascal compiler).
Btw, isn't the .NET framework some kind of attempt to do exactly that,
ie. being able to call libraries made in any language from another language? | | | | re: what are C++ABI;s
And it's a constant source of discussion: why Quote:
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)? In many ways, it's a
serious problem with C++ that the question doesn't have any
answers which would be really relevant here
Which is why I was so damn disappointed when I knew that the TR1
didn't even consider the ABIs. Truly a shame IMO.
Regards,
Fernando. | | | | re: what are C++ABI;s
On 2008-05-15 14:06, Juha Nieminen wrote: Quote:
James Kanze wrote: Quote:
>And it's a constant source of discussion: why
>can't I link code compiled with Borland with code compiled with
>Microsoft (which is possible for C)?
>
A standardized ABI would allow even more than that. For example, it
would allow linking object files created by compilers of different
languages into the binary (such as for example object files created by a
pascal compiler).
>
Btw, isn't the .NET framework some kind of attempt to do exactly that,
ie. being able to call libraries made in any language from another language?
Kind of, the idea behind .Net is that you "compile" code in different
languages into a standardised byte-code format (the Common Intermediate
Language), This allows you to link to any other module compiled to the
CIL. Unfortunately the CIL is quite high-level and many existing
languages (such as C++) can not be accurately translated to CIL which is
why you get .Net versions of those languages (like C++/CLI).
--
Erik Wikström | | | | re: what are C++ABI;s
On May 15, 6:43 pm, Fernando Gómez <fernando.a.gome...@gmail.com>
wrote: Quote: Quote:
And it's a constant source of discussion: why
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)? In many ways, it's a
serious problem with C++ that the question doesn't have any
answers which would be really relevant here
Quote:
Which is why I was so damn disappointed when I knew that the TR1
didn't even consider the ABIs. Truly a shame IMO.
The reason is simple: any API must be platform specific (at
least given current technology). There's no way code that I
compile on my Sun Sparc can be made to run on a PC. Thus,
languages which don't depend on a virtual machine can't define
a standard API. For that matter, even languages like Java,
which do define one (through JVM), tend to consider it separate
from the language standard: the specification of the Java
language doesn't specify an API, and the specification of JVM
doesn't specify the language used to compile to it.
As has been frequently pointed out, JVM is actually a platform,
like Windows on a PC. And it is the platform which should
define the API (which should apply to all of the programming
languages on the platform). The current situation is that most
platforms do define an API, but without many of the elements
needed for C++. So each compiler extends the platform API in a
different way. If I use C or Fortran, I can link code compiled
with the Sun compiler with code compiled with the GNU compiler.
If I use C++ (or Ada, I think), I can't. The problem isn't with
the C++ or Ada language standard, but with Sun's standard for
Solaris.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 | | | | re: what are C++ABI;s
On May 15, 2:06 pm, Juha Nieminen <nos...@thanks.invalidwrote: Quote:
James Kanze wrote: Quote:
And it's a constant source of discussion: why
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)?
Quote:
A standardized ABI would allow even more than that. For
example, it would allow linking object files created by
compilers of different languages into the binary (such as for
example object files created by a pascal compiler).
Up to a point. The supported types still have to be more or
less the same: you won't be able to pass BCD from Cobol to C++,
nor a C++ class to C, and expect it to work right. Quote:
Btw, isn't the .NET framework some kind of attempt to do
exactly that, ie. being able to call libraries made in any
language from another language?
An API depends on the platform. I'm not too familiar with .NET,
but I think it's something along the lines of JVM: a "platform"
designed to be easily and efficiently emulated on a variety of
hardware platforms. (Unlike JVM, on the other hand, I think it
does try to take a number of different languages into
consideration.)
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 | | | | re: what are C++ABI;s Quote: Quote: Quote:
And it's a constant source of discussion: why
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)? In many ways, it's a
serious problem with C++ that the question doesn't have any
answers which would be really relevant here
Which is why I was so damn disappointed when I knew that the TR1
didn't even consider the ABIs. Truly a shame IMO.
>
The reason is simple: any API must be platform specific (at
least given current technology). There's no way code that I
compile on my Sun Sparc can be made to run on a PC. Thus,
languages which don't depend on a virtual machine can't define
a standard API. For that matter, even languages like Java,
which do define one (through JVM), tend to consider it separate
from the language standard: the specification of the Java
language doesn't specify an API, and the specification of JVM
doesn't specify the language used to compile to it.
>
As has been frequently pointed out, JVM is actually a platform,
like Windows on a PC. And it is the platform which should
define the API (which should apply to all of the programming
languages on the platform). The current situation is that most
platforms do define an API, but without many of the elements
needed for C++. So each compiler extends the platform API in a
different way. If I use C or Fortran, I can link code compiled
with the Sun compiler with code compiled with the GNU compiler.
If I use C++ (or Ada, I think), I can't. The problem isn't with
the C++ or Ada language standard, but with Sun's standard for
Solaris.
>
But AFAIK, C does define an ABI.
I don't actually notice what the API has to do with the ABI, or why an
ABI has to be plataform specific.
Regards,
Fernando. | | | | re: what are C++ABI;s
Fernando Gómez wrote: Quote:
>
But AFAIK, C does define an ABI.
>
I don't actually notice what the API has to do with the ABI, or why an
ABI has to be plataform specific.
>
Where?
The ABI is defined by the platform, not the language.
--
Ian Collins. | | | | re: what are C++ABI;s
On 16 mai, 19:50, Fernando Gómez <fernando.a.gome...@gmail.comwrote: Quote: Quote: Quote:
And it's a constant source of discussion: why
can't I link code compiled with Borland with code compiled with
Microsoft (which is possible for C)? In many ways, it's a
serious problem with C++ that the question doesn't have any
answers which would be really relevant here
Which is why I was so damn disappointed when I knew that the TR1
didn't even consider the ABIs. Truly a shame IMO.
Quote: Quote:
The reason is simple: any API must be platform specific (at
least given current technology). There's no way code that I
compile on my Sun Sparc can be made to run on a PC. Thus,
languages which don't depend on a virtual machine can't define
a standard API. For that matter, even languages like Java,
which do define one (through JVM), tend to consider it separate
from the language standard: the specification of the Java
language doesn't specify an API, and the specification of JVM
doesn't specify the language used to compile to it.
Quote: Quote:
As has been frequently pointed out, JVM is actually a platform,
like Windows on a PC. And it is the platform which should
define the API (which should apply to all of the programming
languages on the platform). The current situation is that most
platforms do define an API, but without many of the elements
needed for C++. So each compiler extends the platform API in a
different way. If I use C or Fortran, I can link code compiled
with the Sun compiler with code compiled with the GNU compiler.
If I use C++ (or Ada, I think), I can't. The problem isn't with
the C++ or Ada language standard, but with Sun's standard for
Solaris.
Quote:
But AFAIK, C does define an ABI.
Since when? C has the same problem as C++: it can't define an
ABI, since it has to work on different platforms. Quote:
I don't actually notice what the API has to do with the ABI,
or why an ABI has to be plataform specific.
Well, the ABI for C on a Sparc, under Solaris, says that the
first five arguments go into the registers o0-o4, at least if
they are int's or pointers. That's going to be a little bit
hard to implement on an Intel, which doesn't have as many
registers (and above all, doesn't manage them at all in the same
manner).
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 | | | | re: what are C++ABI;s Quote: Quote:
I don't actually notice what the API has to do with the ABI,
or why an ABI has to be plataform specific.
>
Well, the ABI for C on a Sparc, under Solaris, says that the
first five arguments go into the registers o0-o4, at least if
they are int's or pointers. That's going to be a little bit
hard to implement on an Intel, which doesn't have as many
registers (and above all, doesn't manage them at all in the same
manner).
>
Ok, I think then that I had a wrong concept of an ABI. I thought it
was all about mangling and calling conventions. | | | | re: what are C++ABI;s
On May 16, 3:23 pm, Fernando Gómez <fernando.a.gome...@gmail.com>
wrote: Quote: Quote: Quote:
I don't actually notice what the API has to do with the ABI,
or why an ABI has to be plataform specific.
> Quote:
Well, the ABI for C on a Sparc, under Solaris, says that the
first five arguments go into the registers o0-o4, at least if
they are int's or pointers. That's going to be a little bit
hard to implement on an Intel, which doesn't have as many
registers (and above all, doesn't manage them at all in the same
manner).
>
Ok, I think then that I had a wrong concept of an ABI. I thought it
was all about mangling and calling conventions.
It is. ABI has nothing to do with crossing platform boundaries. It's
a standard, well-defined way of doing things like name mangling,
calling conventions, argument passing, alignment, etc. It is usually
defined per hardware platform, and smart OSes follow it. So in the
end, an object file built by g++ can be linked with an object file
built by Sun CC, on the same platform. If you do it right, you can
link objects across languages on the same platform. If you're really
good you can link objects across OSes (e.g. SCO vs BSD vs Linux).
C++ does not have that. I can't even guarantee to be able to link
against objects from a different version of the same compiler!
Any arguments about linking sparc and x86 code are red herrings.
Tim | | | | re: what are C++ABI;s
Tim H wrote: Quote:
On May 16, 3:23 pm, Fernando Gómez <fernando.a.gome...@gmail.com>
wrote: Quote: Quote:
>>>I don't actually notice what the API has to do with the ABI,
>>>or why an ABI has to be plataform specific.
>>Well, the ABI for C on a Sparc, under Solaris, says that the
>>first five arguments go into the registers o0-o4, at least if
>>they are int's or pointers. That's going to be a little bit
>>hard to implement on an Intel, which doesn't have as many
>>registers (and above all, doesn't manage them at all in the same
>>manner).
>Ok, I think then that I had a wrong concept of an ABI. I thought it
>was all about mangling and calling conventions.
>
It is. ABI has nothing to do with crossing platform boundaries. It's
a standard, well-defined way of doing things like name mangling,
calling conventions, argument passing, alignment, etc. It is usually
defined per hardware platform, and smart OSes follow it. So in the
end, an object file built by g++ can be linked with an object file
built by Sun CC, on the same platform.
Er, no, you can't. Or did you mean gcc and Sun cc? Quote:
>
C++ does not have that. I can't even guarantee to be able to link
against objects from a different version of the same compiler!
>
Ah, you appear to be contradicting your earlier statement here.
--
Ian Collins. | | | | re: what are C++ABI;s Quote: Quote:
Ok, I think then that I had a wrong concept of an ABI. I thought it
was all about mangling and calling conventions.
>
It is. ABI has nothing to do with crossing platform boundaries. It's
a standard, well-defined way of doing things like name mangling,
calling conventions, argument passing, alignment, etc. It is usually
defined per hardware platform, and smart OSes follow it. So in the
end, an object file built by g++ can be linked with an object file
built by Sun CC, on the same platform. If you do it right, you can
link objects across languages on the same platform. If you're really
good you can link objects across OSes (e.g. SCO vs BSD vs Linux).
>
C++ does not have that. I can't even guarantee to be able to link
against objects from a different version of the same compiler!
>
Any arguments about linking sparc and x86 code are red herrings.
>
Tim
So, if we take away all the politics surrounding the standardization
process of C++, it'll be possible to define an ABI for C++, won't it? | | | | re: what are C++ABI;s
Fernando Gómez wrote: Quote:
>
So, if we take away all the politics surrounding the standardization
process of C++, it'll be possible to define an ABI for C++, won't it?
No, reread James' reply up-thread. It would be possible to define an
ABI for a particular platform, but that's well beyond the scope of the
language standard.
--
Ian Collins. | | | | re: what are C++ABI;s
On 17 mai, 00:23, Fernando Gómez <fernando.a.gome...@gmail.comwrote: Quote: Quote: Quote:
I don't actually notice what the API has to do with the ABI,
or why an ABI has to be plataform specific.
Quote: Quote:
Well, the ABI for C on a Sparc, under Solaris, says that the
first five arguments go into the registers o0-o4, at least
if they are int's or pointers. That's going to be a little
bit hard to implement on an Intel, which doesn't have as
many registers (and above all, doesn't manage them at all in
the same manner).
Quote:
Ok, I think then that I had a wrong concept of an ABI. I
thought it was all about mangling and calling conventions.
It's mainly about calling conventions. (Mangling is part of the
conventions, when it comes down to it.) Where the compiler puts
the arguments is part of the calling conventions.
It's also about ensuring that the called function can do
something with the arguments: things like class layout, and how
virtual functions are implemented, for example.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 | | | | re: what are C++ABI;s
On 17 mai, 07:36, Tim H <thoc...@gmail.comwrote: Quote:
On May 16, 3:23 pm, Fernando Gómez <fernando.a.gome...@gmail.com>
wrote:
Quote: Quote: Quote:
I don't actually notice what the API has to do with the
ABI, or why an ABI has to be plataform specific.
Quote: Quote: Quote:
Well, the ABI for C on a Sparc, under Solaris, says that
the first five arguments go into the registers o0-o4, at
least if they are int's or pointers. That's going to be a
little bit hard to implement on an Intel, which doesn't
have as many registers (and above all, doesn't manage them
at all in the same manner).
Quote: Quote:
Ok, I think then that I had a wrong concept of an ABI. I
thought it was all about mangling and calling conventions.
Quote:
It is. ABI has nothing to do with crossing platform
boundaries. It's a standard, well-defined way of doing things
like name mangling, calling conventions, argument passing,
alignment, etc. It is usually defined per hardware platform,
and smart OSes follow it. So in the end, an object file built
by g++ can be linked with an object file built by Sun CC, on
the same platform.
Or could be, if that platform defined an ABI, and both compilers
respected it. In fact, there isn't a standard ABI defined for
Sparc, so you can't link an object file compiled by Sun CC with
one compiled by g++ on a Sparc.
An ABI can be more or less complete. As I mentionned upstream,
the *only* platform I know of which defines an ABI for C++ is
Intel's Itanium. Quote:
If you do it right, you can link objects across languages on
the same platform. If you're really good you can link objects
across OSes (e.g. SCO vs BSD vs Linux).
Quote:
C++ does not have that. I can't even guarantee to be able to
link against objects from a different version of the same
compiler!
Quote:
Any arguments about linking sparc and x86 code are red
herrings.
Except that that's what having the ABI as part of the language
standard would require.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 | | | | re: what are C++ABI;s
Fernando GĂłmez wrote: Quote:
> Quote: Quote:
I don't actually notice what the API has to do with the ABI,
or why an ABI has to be plataform specific.
>>
>Well, the ABI for C on a Sparc, under Solaris, says that the
>first five arguments go into the registers o0-o4, at least if
>they are int's or pointers. That's going to be a little bit
>hard to implement on an Intel, which doesn't have as many
>registers (and above all, doesn't manage them at all in the same
>manner).
>>
>
Ok, I think then that I had a wrong concept of an ABI. I thought it
was all about mangling and calling conventions.
And what did you think calling conventions are? The above (passing the first
n arguments in registers) just is a calling convention. | | | | re: what are C++ABI;s
Juha Nieminen wrote: Quote:
James Kanze wrote: Quote:
>And it's a constant source of discussion: why
>can't I link code compiled with Borland with code compiled with
>Microsoft (which is possible for C)?
>
A standardized ABI would allow even more than that. For example, it
would allow linking object files created by compilers of different
languages into the binary (such as for example object files created by a
pascal compiler).
ABIs usually are language specific, since different languages have different
features or at least implement them differently, so it's often not possible
to find a single ABI that fits all of a set of languages. Quote:
Btw, isn't the .NET framework some kind of attempt to do exactly that,
ie. being able to call libraries made in any language from another
language?
Yes, however, the languages need to be modified to fit into the .NET
framework. That's why there is a special .NET version of C++. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,374 network members.
|