By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,122 Members | 1,075 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,122 IT Pros & Developers. It's quick & easy.

Vtable layout and C++ compilers.

P: n/a
Neo
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?

Regards
Vikram S

Dec 28 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Neo wrote:
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?
Yes. There is nothing mandated in the standard about vtables.
Dec 28 '06 #2

P: n/a
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.
Dec 28 '06 #3

P: n/a
Neo
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.

Dec 28 '06 #4

P: n/a
"COM specification works for all compilers and platforms." -- It is
impossible if Microsoft do not make the implementation in platforms.

"Neo :
"
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.
Dec 28 '06 #5

P: n/a
Neo wrote:
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.
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.

Dec 28 '06 #6

P: n/a
Neo wrote:
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.
It is possible to implement an API that supports the COM specification,
that will work on any given compiler or platform. That doesn't that COM
is supported natively by all compilers or platforms. AFAIK, it is only
"natively" supported on Windows, by the Microsoft (and Intel?) compilers.

--
Mike Smith
Dec 28 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.