This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
VTBL and COM
- From: Olenin Vladimir <vahvarh at rbcmail dot ru>
- To: gcc at gnu dot org
- Cc: eldhenn at yahoo dot com
- Date: Sun, 24 Nov 2002 00:40:15 +0300 (MSK)
- Subject: VTBL and COM
Salut guys,
We are planning making a COM-like library for unix systems (and
maybe others) which will allow about same things such as microsoft
version - i.e. allowing to switch to later version of library without
recompiling program code.
BUT, we dont want to use interfaces (such as in Microsoft version)
because they brake to pieces the object-oriented programming paradigm
(original Microsoft COM breaks implementation inheritance, futher MS
versions of COM break incapsulation and (partialy) inheritance).
But, when a method is added to parent class, there happens a change
of method ids in VTBL in children classes.
For example:
class A {
A();
void m1();
};
class B: public A {
B();
void m3();
};
When we add A::m2(), id of m3() is incremented by 1 as it must.
We found (as we think) at least a partial solution of this problem.
There could be a program (daemon) which will edit compiled programs
(machine-specific binary code) and change IDs in them (It of course
has to know what and where to change).
But we don't know for sure what and where to change (for example,
where is VTBL located and how it is encoded/generated and what we
shall have to change in it).
If there is not enough data in compiled version there could be an
autogenerated method which will provide the data we need (for example
original IDs of methods), we think.
Yours, Olenin Vladimir, Petrov Dmithriy