| View previous topic :: View next topic |
| Author |
Message |
Neo Guest
|
Posted: Thu Dec 28, 2006 10:10 am Post subject: Vtable layout and C++ compilers. |
|
|
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
Regards
Vikram S |
|
| Back to top |
|
 |
Rolf Magnus Guest
|
Posted: Thu Dec 28, 2006 10:10 am Post subject: Re: Vtable layout and C++ compilers. |
|
|
Neo wrote:
| Quote: | Mathias Gaunard wrote:
Neo wrote:
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
Yes.
There is not even a guarantee that a vtable is used.
is such situation, there is not guarantee that polymorphism will work
across component compiled by different compilers and it is against one
of the manjor features of C++.
|
Which would be...?
You have to look at the ABI that the compiler implements. If it's the same
for both compilers, it should be possible to link together object code
generated by both compilers. Note that there is a whole lot more about the
ABI than just vtables. Think about how values are passed to functions, how
they are returned, how function names are mapped to internal symbol names
(so-called name mangling), how exceptions are thrown and so on.
ISO C++ deliberately doesn't define how that is done to give compiler
implementors more freedom. There are many different hardware/OS
combinations, and the way how to do things best can depend on those.
| Quote: | One thining I would like to mention that all COM (component object
model) component functionality is all based on standard vtable layout
and Microsoft claims that COM specification works for all compilers and
platforms.
|
I think the only difference here is that the ABI requirement is reduced to a
common C ABI instead of a common C++ ABI. |
|
| Back to top |
|
 |
Gianni Mariani Guest
|
Posted: Thu Dec 28, 2006 10:10 am Post subject: Re: Vtable layout and C++ compilers. |
|
|
Neo wrote:
| Quote: | Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
|
Yes. There is nothing mandated in the standard about vtables. |
|
| Back to top |
|
 |
Mathias Gaunard Guest
|
Posted: Thu Dec 28, 2006 10:10 am Post subject: Re: Vtable layout and C++ compilers. |
|
|
Neo wrote:
| Quote: | Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
|
Yes.
There is not even a guarantee that a vtable is used. |
|
| Back to top |
|
 |
Neo Guest
|
Posted: Thu Dec 28, 2006 10:10 am Post subject: Re: Vtable layout and C++ compilers. |
|
|
Mathias Gaunard wrote:
| Quote: | Neo wrote:
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
Yes.
There is not even a guarantee that a vtable is used.
|
is such situation, there is not guarantee that polymorphism will work
across component compiled by different compilers and it is against one
of the manjor features of C++.
One thining I would like to mention that all COM (component object
model) component functionality is all based on standard vtable layout
and Microsoft claims that COM specification works for all compilers and
platforms. |
|
| Back to top |
|
 |
kuoxin Guest
|
Posted: Thu Dec 28, 2006 10:10 am Post subject: Re: Vtable layout and C++ compilers. |
|
|
"COM specification works for all compilers and platforms." -- It is
impossible if Microsoft do not make the implementation in platforms.
"Neo :
"
| Quote: | Mathias Gaunard wrote:
Neo wrote:
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
Yes.
There is not even a guarantee that a vtable is used.
is such situation, there is not guarantee that polymorphism will work
across component compiled by different compilers and it is against one
of the manjor features of C++.
One thining I would like to mention that all COM (component object
model) component functionality is all based on standard vtable layout
and Microsoft claims that COM specification works for all compilers and
platforms. |
|
|
| Back to top |
|
 |
|