.idl与.odl的区别

From: http://hi.baidu.com/%CD%E6%CA%AF%CD%B7%B5%C4%D0%A1%BA%A2/blog/item/1b9a942fe8cfcf594ec22629.html

1.
.odl和.idl在com中的功能相同.
前者是ActiveX中的 后者是ATL中.

可在前者的文件中 用 #import "XXXXX.idl" 的方式包含后者. 反过来没有试过.
2.
When using IDL, you must declare the interfaces that will generate the C++ source files outside of the library declaration. For the ODL, this step is not necessary. Other than a few minor language differences, the IDL and ODL are identical in terms of syntax and organization.
3.
ODL是Microsoft对IDL的扩展
4.
odl ---对象描述语言
idl ---接口描述语言
其实是一个功能就是在写法上有些不同,eg:
odl:
[
uuid(3C591B20-1F13-101B-B826-00DD01103DE1), // LIBID_Lines.
helpstring("Lines 1.0 Type Library"),
lcid(0x09),
version(1.0)
]
library Lines
{
importlib("stdole.tlb");

[
uuid(3C591B25-1F13-101B-B826-00DD01103DE1), // IID_Ipoint.
helpstring("Point object."),
oleautomation,
dual
]
interface IPoint : IDispatch
{
[propget, helpstring("Returns and sets x coordinate.")]
HRESULT x([out, retval] int* retval);
[propput, helpstring("Returns and sets x coordinate.")]
HRESULT x([in] int Value);

[propget, helpstring("Returns and sets y coordinate.")]
HRESULT y([out, retval] int* retval);
[propput, helpstring("Returns and sets y coordinate.")]
HRESULT y([in] int Value);
}
[
uuid(3C591B21-1F13-101B-B826-00DD01103DE1), // CLSID_Lines.
helpstring("Lines Class"),
appobject
]
coclass Lines
{
[default] interface IPoint;
interface IDispatch;
}
}
idl:

[
uuid(3C591B25-1F13-101B-B826-00DD01103DE1), // IID_Ipoint.
helpstring("Point object."),
oleautomation,
dual
]
interface IPoint : IDispatch
{
[propget, helpstring("Returns and sets x coordinate.")]
HRESULT x([out, retval] int* retval);
[propput, helpstring("Returns and sets x coordinate.")]
HRESULT x([in] int Value);

[propget, helpstring("Returns and sets y coordinate.")]
HRESULT y([out, retval] int* retval);
[propput, helpstring("Returns and sets y coordinate.")]
HRESULT y([in] int Value);
}
[
uuid(3C591B20-1F13-101B-B826-00DD01103DE1), // LIBID_Lines.
helpstring("Lines 1.0 Type Library"),
lcid(0x09),
version(1.0)
]
library Lines
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");

[
uuid(3C591B21-1F13-101B-B826-00DD01103DE1), // CLSID_Lines.
helpstring("Lines Class"),
appobject
]
coclass Lines
{
[default] interface IPoint;
interface IDispatch;
}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值