How do I get a pointer to the vtable in this:
ID3D11Device *dev; //the pointer to the device interface
This is what I have right now and I don't think it's right.
uintptr_t* pInterfaceVTable = *(uintptr_t**)dev;
If it is, then how do I get the member functions? Again, this is what I have right now.
uintptr_t** g_deviceFunctionAddresses = new uintptr_t*[D3D11_DEVICE_METHOD_COUNT];
if(dev != NULL && swapchain != NULL){
for(int i=0; i<D3D11_DEVICE_METHOD_COUNT; i++){
g_deviceFunctionAddresses[i] = (uintptr_t*)pInterfaceVTable[i];
}
smplvtablefunction = pInterfaceVTable[functionoffset];
}
I've been stuck for a while on this.
The vtable is defined in the header as ID3D11DeviceVtbl
. You need to #include d3d11.h as a C header though, otherwise you get the class definition with a hidden vtable.