Mike Hearn wrote:
On Thu, 13 Jan 2005 20:33:10 +0000, Ann and Jason Edmeades wrote:
Whats the solution?
In d3d8 I would have coded IWineD3DSurfaceImpl_GetParent as IWineD3DResourceImpl_GetParent(iface, pParent) because the Impl versions were prototyped - Is this the only way to solve this?
I'm kind of confused too but it seems you really want two interfaces that inherit from each other here rather than having two separate interfaces that happen to have the same name.
So, IWineD3DSurface should inherit from IWineD3DResource which in turn should inherit from IUnknown. Then you fill out the vtable appropriately for overrides. Isn't object orientation in C fun :)
typedef struct { IWineD3DSurfaceVtbl *lpVtbl; DWORD refcount; .... } WineD3DSurface;
static IWineD3DSurfaceVtbl SurfaceVtbl = { /* IUnknown methods are reimplemented per object here but you could be cleverer */ WineD3DSurface_QueryInterface, WineD3DSurface_AddRef, WineD3DSurface_Release,
/* Now for the Resource methods */ WineD3DResource_XXX, WineD3DResource_YYY, /* Now for the Surface methods */ WineD3DSurface_AAA, WineD3DSurface_BBB
};
But you'll get a warning because the WineD3DResource functions will take a different type iface variable as their first parameter. You could cast it to the correct type, but you'll lose all type checking on the function and I wouldn't recommend it.
Rob