473,379 Members | 1,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Vtable layout and C++ compilers.

Neo
Hi Friends,
Is virtual function table layout (VTABLE) is compiler dependent?

Regards
Vikram S

Dec 28 '06 #1
6 6004
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
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
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
"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

54
by: sks_cpp | last post by:
What is a type_info function, more particularly, what is a type_info node? Are these related to the vtable by any means? I have seen linker errors such as: "undefined reference to SomeClass...
6
by: Nolan Martin | last post by:
Hello, I was wondering if it were possible to access the vtable directly. Are there any resources that detail the inner workings of the vtable?
0
by: Hans Kiehn | last post by:
Hi *, I'm debugging a crash in a very big and complex server application. This server run's fine for days and hours and suddenly crashes. I've spent 2 weeks of time now, but cannot find the...
4
by: rahul8143 | last post by:
hello, what happens to VTABLE when base class has virtual function and derived class does not override it? Does derived class also builds VTABLE if it has no functions? eg. if code is like...
9
by: kish_nand | last post by:
Could someone please explain me the concept behind virtual functions and vtables. I am little confused about this. Please refer to the following code and tell me how many virtual tables would be...
17
by: ypjofficial | last post by:
Hello All, I have read in many c++ literature that vtable is nothing but an array of pointer to virtual functions inside a class.And the class where the virtual function/s are declared stores the...
1
by: Neo | last post by:
Hi Friends, Is virtual function table (VTABLE) is compiler dependent? Regards Vikram S
28
by: kyle york | last post by:
Greetings, Why does the C standard require the members of a structure not be re-ordered (6.2.5.20)? Padding is allowed, and platform dependent, which means one cannot rely on the exact layout...
10
by: Ole Nielsby | last post by:
James Kanze <james.kanze@gmail.comwrote: COM does rely on vtable layout. COM interfaces are declared as pure virtual classes, all methods using stdcall convention, and this works because most...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.