AnsweredAssumed Answered

Blackfin C++ Compiler vtable layout

Question asked by apankoke on Feb 7, 2011
Latest reply on Mar 4, 2011 by CraigG

Hi,

I'am writing a loader to dynamically load C++ code in static modules (dxe). In my examination of how ADI call virtual functions I've found

the virtual tables of the objects. They called for e.g  __vtbl__13CTest..... just following the ADI name mangling scheme.

 

1. I don't understand the layout of the vtables

     (e.g. in 32 bit hex format. assume that the class has two virtual functions VirtualFunction1,VirtualFunction2:)

__vtbl__13CTest.....

00000000

00000000

00000000

<AddrOfVirtualFunction1>

00000000

<AddrOfVirtualFunction2>

What is the meaning of the "zero" filled entries?

 

2. The virtual table pointer of the class instance is located after the member variables:

Are the member variables always in declaration order?

 

this->

     membervar1

     membervar2

     membervar3

     ...

     vtable pointer

 

3. In case of using multiple inheritance there is an additional vtable for calling the implementations of the virtual functions of the interface (base class)

What the sense of that table?

 

Is there any documentation of the vtable layout, vtable pointer location and calling convention in multiple inheritance class environments?

 

Thanks

Andreas Pankoke

Outcomes