1 Mar 2008 22:08
Incorrect vtable generation in MinGW?
I noticed that MinGW's G++ doesn't make vtables using the same algorithm as Visual C++, which can break COM
interfaces. If there are two overloaded functions with the same name, Visual Studio will group the
functions of the same name together instead of preserve the ordering specified in the virtual table.
Input program:
struct Vtable
{
virtual void Overloaded(int) = 0;
virtual void Other() = 0;
virtual void Overloaded(Vtable&) = 0;
};
void Function(Vtable& param)
{
param.Overloaded(param);
}
Visual Studio assembly code (/Ox /Oy-):
push ebp
mov ebp, esp
mov ecx, DWORD PTR 8[ebp]
mov eax, DWORD PTR [ecx]
mov edx, DWORD PTR [eax]
push ecx
call edx
pop ebp
ret
(Continue reading)
RSS Feed