COM inheritance Q

Ann and Jason Edmeades us at the-edmeades.demon.co.uk
Thu Jan 13 15:38:37 CST 2005


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

That's what I tried originally, but C cant do it if surface and resource are
in different files (That was exactly a thread on wined3d because I hit this
and was told there was no way around it).

Also, the Surface XXX may want to override the Resource XXX or it may be
happy just calling it... 

I'll go for the prototypes/calling directly, as per d3d8 - I've used my
editor macro skills to convert the interface definition into prototypes
fairly quickly!

And yes... C++ would be a lot easier, and if you knew me you'd know how hard
it is saying that (I hate C++ compared to C, Java etc).

Jason





More information about the wine-devel mailing list