core.sys.windows.com.ComObject apparently has wrongly laid out Vtable

Carl Sturtivant sturtivant at gmail.com
Thu Mar 21 17:51:17 UTC 2024


On Thursday, 21 March 2024 at 16:10:25 UTC, Walter Bright wrote:
> You can invent your own COM-like system in D by using 
> interfaces, but they won't work with Windows COM code.

I'm not sure we understand each other. I am not interested in 
anything COM-like that doesn't interoperate with the outside 
world of COM, but perhaps you were making the point that other 
suggestions in this thread simply won't work.

I'm trying to write some useful abstractions for COM so as to 
lower the high administrative friction of writing COM code. I am 
working in the ImportC/Use-Windows-Headers situation because that 
provides an environment rich in existing definitions in which to 
do that, and I want my machinery to work with any new COM header 
files in the future.

I definitely will be using your D interface IUnknown from 
Druntime because the D language has given it special status that 
as you have clarified above in this thread cannot be simulated in 
another way with D classes. Thank you for making it clear in 
detail that COM can only be approached with classes by using 
Druntime's IUnknown.

I'll just have to work around there being two GUID type 
definitions that are essentially identical when I do that, one 
from Windows' `guiddef.h` and one from Druntime's `basetyps.d`, 
the second used in Druntime's IUnknown.QueryInterface, the first 
used everywhere by Windows.






More information about the Digitalmars-d mailing list