1

如何在此获得指向 vtable 的指针:

ID3D11Device *dev;          //the pointer to the device interface

这就是我现在所拥有的,我认为这是不对的。

uintptr_t* pInterfaceVTable = *(uintptr_t**)dev;

如果是,那么我如何获得成员函数?再说一次,这就是我现在所拥有的。

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];
}

我已经被困了一段时间了。

4

1 回答 1

0

vtable 在标头中定义为ID3D11DeviceVtbl. 不过,您需要将 #include d3d11.h 作为 C 标头,否则您将获得带有隐藏 vtable 的类定义。

于 2014-12-05T04:40:51.150 回答