vtable

Under what circumstances can a vtable pointer be null (or 0x1)?

I am currently debugging a crashlog. The crash occurs because the vtable pointer of a (c++-) object is 0x1, while the rest of the object seems to be ok as far as I can tell from the crashlog. The program crashes when it tries to call a virtual method. My question: Under what circumstances can a vtable pointer become null? Does operator...

Virtual Table C++

I read a lot of people writing "a virtual table exists for a class that has a virtual function declared in it". My question is, does a vtable exists only for a class that has a virtual function or does it also exist for classes derived from that class. e.g class Base{ public: virtual void print(){cout<<"Base Print\n";} };...

Debugging vtable Linker Errors in GCC

Now and then when using GCC I get cryptic errors like this: undefined reference to 'vtable for classname' When it's not caused by a missing library, this not-very-descriptive error message always causes me to dig through code files line by line to find the missing implementation for a virtual function. Is there a way to make the linke...

What does "vtable fixup" mean?

I have heard this term, "vtable fixup", used. What does it mean? I had no success asking Google. I already know what a vtable is so that does not need to be defined. ...

Why does the following class have a virtual table?

Suppose I have a diamond inheritance situation as follows: class A{ public: virtual void foo(){}; }; class B: public virtual A{ public: virtual void foo(){}; }; class C: public virtual A{ public: virtual void foo(){}; }; class D: B, C{}; The last line yields a compilation error citing ambiguity. As I understand it, the pr...

c++ d3d hooking - COM vtable

Trying to make a Fraps type program. See comment for where it fails. #include "precompiled.h" typedef IDirect3D9* (STDMETHODCALLTYPE* Direct3DCreate9_t)(UINT SDKVersion); Direct3DCreate9_t RealDirect3DCreate9 = NULL; typedef HRESULT (STDMETHODCALLTYPE* CreateDevice_t)(UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD B...

Virtual method tables

When discussing sealed classes, the term "virtual function table" is mentioned quite frequently. What exactly is this? I read about a method table a while ago (I don't remember the purpose of the purpose of this either) and a google/search on here brings up C++ related results. Thanks ...

How to iterate the vtable of COM coclass?

How to iterate (infact access) the vtable of COM coclass(that will implement the methods of its exposed interfaces).? Only I need to access vtable where all addresses of exposed methods of its interfaces are stored. e.g Say Math is COM object and its exposed interface is "Operations" and "Sum" is the method of this interface. I need ...

How to get function name against function address by reading co-classs'es vtable?

Hello, I need to call the co-class function by reading its address from vtable of COM exposed interface methods. I need some generic way to read addresses. Now I need to call the function, which would have specific address(NOT KNOWN) arguments(parameters) which I have collected from TLB, and name as well. How that address corresponds t...

vtable in polymorphic class of C++ using gdb

How to display vtable using a pointer to base class object having virtual functions? ...

Where is pure virtual function located in C++?

Which virtual table will be pure virtual function located? In the base class or derived class? For example, what does the virtual table look like in each class? class Base { virtual void f() =0; virtual void g(); } class Derived: public Base{ virtual void f(); virtual void g(); } ...

Qt Object Linker Problem " undefined reverence to vtable"

This is my header: #ifndef BARELYSOCKET_H #define BARELYSOCKET_H #include <QObject> //! The First Draw of the BarelySocket! class BarelySocket: public QObject { Q_OBJECT public: BarelySocket(); public slots: void sendMessage(Message aMessage); signals: void reciveMessage(Message aMessage); private: // QVector<M...

Does C++ have a static polymorphism implementation of interface that does not use vtable?

Does C++ have a proper implementation of interface that does not use vtable? for example class BaseInterface{ public: virtual void func() const = 0; } class BaseInterfaceImpl:public BaseInterface{ public: void func(){ std::cout<<"called."<<endl; } } BaseInterface* obj = new BaseInterfaceImpl(); obj->func(); the call to func at the ...

Why Exception occured getting address of COM function ?

I am getting address of COM function by loading type library (TLB) and iterating over types using ITypeLib and ITypeInfo. After calling AddressOfMember function of ITypeInfo I am facing the following exception: System.Runtime.InteropServices.COMException (0x800288BD): Wrong module kind for the operation. (Exception from HRESULT: 0x80...

How to Call COM unmanaged code at Runtime from C#.NET using ITypeLib and ITypeInfo ?

Hello, I need to call unmanaged COM code from C#.NET. By Loading unmanaged COM Type libraries from (LoadTypeLibEx), I am able to iterate over all exposed types by COM TLB. Now I need to call those exposed methods at run time by knowing their addresses or by accessing some how COM vtable's starting address and by applying indexing for ge...

Speed comparison - Template specialization vs. Virtual Function vs. If-Statement

Just to get it out of the way... Premature optimization is the root of all evil Make use of OOP etc. I understand. Just looking for some advice regarding the speed of certain operations that I can store in my grey matter for future reference. Say you have an Animation class. An animation can be looped (plays over and over) or not lo...

How to use the vtable to determine class type

I was recently on an interview for a position where C/C++ is the primary language and during one question I was told that it's possible to use the vtable to determine which class in a hierarchy a base pointer actually stores. So if, for example you have class A { public: A() {} virtual ~A() {} virtua...

Visual C++ Compiler Option To Dump Class Hierarchy

Is there any compiler option in MS Visual C++ equivalent to GCC's -fdump-class-hierarchy? i.e. showing the virtual function table layout. ...

Getting list of all existing vtables.

In my application I have quite some void-pointers (this is because of historical reasons, application was originally written in pure C). In one of my modules I know that the void-pointers points to instances of classes that could inherit from a known base class, but I cannot be 100% sure of it. Therefore, doing a dynamic_cast on the vo...

What causes "java.lang.IncompatibleClassChangeError: vtable stub"?

What causes "java.lang.IncompatibleClassChangeError: vtable stub"? In our application, we have seen this error pop up randomly and very seldom (just twice so far, and we run it a lot). It is not readily reproducible, even when restarting the app, using the same jvm/jars without rebuilding. As for our build process, we clean all classe...