www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Why is MS-COM a language feature?

reply Frank Benoit <keinfarbton googlemail.com> writes:
This is inspired by the question of Bill B. from the "Comparing 
interfaces does not call opEquals" thread.

Even Java can bridge to COM without language support. See SWT.
So if it is possible to connect to COM with lib functions, why have it 
directly supported by the language?

Who of this community is actually using COM? How is your experience? 
What is possible? What is not? Could it be done in a lib?

Wouldn't it make much sense to throw the COM support out of D entirely?
Jul 29 2008
next sibling parent Extrawurst <spam extrawurst.org> writes:
Frank Benoit schrieb:
 Who of this community is actually using COM?

I am using it. I use it to interface to DirectX components.. But as long as i can do that i dont care if it is by language feature or lib (that is if its not more work, lazy coder u know)
Jul 29 2008
prev sibling parent reply davidl <davidl 126.com> writes:
在 Wed, 30 Jul 2008 04:40:38 +0800,Frank Benoit  
<keinfarbton googlemail.com> 写道:

 This is inspired by the question of Bill B. from the "Comparing  
 interfaces does not call opEquals" thread.

 Even Java can bridge to COM without language support. See SWT.
 So if it is possible to connect to COM with lib functions, why have it  
 directly supported by the language?

Maybe because Java Interface is pure. D interface is not pure, defaultly interface not inherited from IUnknown, you get opEquals, opCmp, etc vtbl from class Object. So it's better call it IPure, not IUnknown so windows specific(from the first view).
 Who of this community is actually using COM? How is your experience?  
 What is possible? What is not? Could it be done in a lib?

You can't get a pure interface without IUnknown compiler support.
 Wouldn't it make much sense to throw the COM support out of D entirely?

-- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
Jul 29 2008
parent davidl <davidl 126.com> writes:
在 Wed, 30 Jul 2008 09:47:37 +0800,davidl <davidl 126.com> 写道:

 在 Wed, 30 Jul 2008 04:40:38 +0800,Frank Benoit  
 <keinfarbton googlemail.com> 写道:

 This is inspired by the question of Bill B. from the "Comparing  
 interfaces does not call opEquals" thread.

 Even Java can bridge to COM without language support. See SWT.
 So if it is possible to connect to COM with lib functions, why have it  
 directly supported by the language?

Maybe because Java Interface is pure. D interface is not pure, defaultly interface not inherited from IUnknown, you get opEquals, opCmp, etc vtbl from class Object.

sorry for the mistake i made here. code in object.d /** * Information about an interface. * A pointer to this appears as the first entry in the interface's vtbl[]. */ struct Interface { ClassInfo classinfo; /// .classinfo for this interface (not for containing class) void *[] vtbl; int offset; /// offset to Interface 'this' from Object 'this' } it's clear that, D Interface gets a special memory layout. While IUnknown means your first entry not pointing to this struct.
 So it's better call it IPure, not IUnknown so windows specific(from the  
 first view).

 Who of this community is actually using COM? How is your experience?  
 What is possible? What is not? Could it be done in a lib?

You can't get a pure interface without IUnknown compiler support.
 Wouldn't it make much sense to throw the COM support out of D entirely?


-- 使用 Opera 革命性的电子邮件客户程序: http://www.opera.com/mail/
Jul 29 2008