Why is MS-COM a language feature?
davidl
davidl at 126.com
Tue Jul 29 18:55:51 PDT 2008
在 Wed, 30 Jul 2008 09:47:37 +0800,davidl <davidl at 126.com> 写道:
> 在 Wed, 30 Jul 2008 04:40:38 +0800,Frank Benoit
> <keinfarbton at 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/
More information about the Digitalmars-d
mailing list