-----Original Message----- From: wine-patches-bounces@winehq.org [mailto:wine-patches- bounces@winehq.org] On Behalf Of Henri Verbeet Sent: Wednesday, January 21, 2009 10:01 AM To: wine-patches@winehq.org Subject: [4/5] ddraw: Get rid of ICOM_INTERFACE.
*obj = ICOM_INTERFACE(This, IDirect3DDevice3);
*obj = &This->IDirect3DDevice3_vtbl;
*obj = ICOM_INTERFACE(This, IDirect3DDevice7);
*obj = This;
- return IDirect3DDevice7_AddRef(ICOM_INTERFACE(This,
IDirect3DDevice7));
- return IDirect3DDevice7_AddRef((IDirect3DDevice7 *)This);
I think it would be better to access IDirect3DDevice7 via explicit specifying the vtable, or an inline function for consistency and to avoid hardwiring the assumption that the IDirect3DDevice7 vtable is the first member of the object
2009/1/21 Stefan Dösinger stefan@codeweavers.com:
I think it would be better to access IDirect3DDevice7 via explicit specifying the vtable, or an inline function for consistency and to avoid hardwiring the assumption that the IDirect3DDevice7 vtable is the first member of the object
I don't see the point. IDirect3DDevice7 is the primary vtable and that's not going to change, ever. We also do things like this about everywhere else, and I don't think ddraw should be special in that regard.
I don't see the point. IDirect3DDevice7 is the primary vtable and that's not going to change, ever. We also do things like this about everywhere else, and I don't think ddraw should be special in that regard.
I don't see any 'primary' vtable in any ddraw object, but that's just my personal view. I also dislike casting between the iface and the impl, which is possible only because vtable is the first member of the impl struct.
My impression was that whenever we have different vtables in an object that there are converter functions from and to all ifaces and no iface is obtained by casting. Of course if we have some policy or enough code to prove my point here wrong please disregard the objection.
2009/1/21 Stefan Dösinger stefan@codeweavers.com:
I don't see the point. IDirect3DDevice7 is the primary vtable and that's not going to change, ever. We also do things like this about everywhere else, and I don't think ddraw should be special in that regard.
I don't see any 'primary' vtable in any ddraw object, but that's just my personal view. I also dislike casting between the iface and the impl, which is possible only because vtable is the first member of the impl struct.
Primary in the sense that it is the table that actually implements most of the methods, including things like QueryInterface(), rather than forwarding them to somewhere else.
My impression was that whenever we have different vtables in an object that there are converter functions from and to all ifaces and no iface is obtained by casting. Of course if we have some policy or enough code to prove my point here wrong please disregard the objection.
Just open a random COM object implementation like eg. dlls/shell32/shlview.c or dlls/comdlg32/filedlgbrowser.c.
2009/1/21 Henri Verbeet hverbeet@gmail.com:
2009/1/21 Stefan Dösinger stefan@codeweavers.com:
I don't see the point. IDirect3DDevice7 is the primary vtable and that's not going to change, ever. We also do things like this about everywhere else, and I don't think ddraw should be special in that regard.
I don't see any 'primary' vtable in any ddraw object, but that's just my personal view. I also dislike casting between the iface and the impl, which is possible only because vtable is the first member of the impl struct.
Primary in the sense that it is the table that actually implements most of the methods, including things like QueryInterface(), rather than forwarding them to somewhere else.
You're also relying on the IDirect3DDevice7 vtable field being the first field on the impl struct, so you should add a big comment to the impl struct warning that bad things will happen if the IDirect3DDevice7 vtable field isn't the first one.
2009/1/21 Rob Shearman robertshearman@gmail.com:
You're also relying on the IDirect3DDevice7 vtable field being the first field on the impl struct, so you should add a big comment to the impl struct warning that bad things will happen if the IDirect3DDevice7 vtable field isn't the first one.
Sure, but I'd say it's pretty hard to find code in Wine that doesn't rely on at least the "main" vtable being the first field in the struct. Probably even outside Wine.