我有两个使用 ATL 和 Microsoft 的 IDL 编写的带有 COM 接口的类型库。我希望一个库中的接口从另一个库中的接口继承。
本质上,我想做 Steven 在如何使用 .tlb 类型在 VS C++ 中创建接口方法?. 唯一回答他的人似乎不明白这个问题。
这是我想做的,在代码中:
SomeLibrary DLL/TLB
ISomeInterface.idl
interface ISomeInterface : IDispatch { ... };
SomeLibrary.idl
import "ISomeInterface.idl";
library SomeLibrary
{
interface ISomeInterface;
};
SomeOtherLibrary DLL/TLB
ISomeOtherInterface.idl
// What do I put here so that the MIDL compiler knows
// what to do when it encounters the ISomeInterface type?
interface ISomeOtherInterface : ISomeInterface { ... };
SomeOtherLibrary.idl
import "ISomeOtherInterface.idl";
library SomeOtherLibrary
{
interface ISomeOtherInterface;
};
MIDLimport
指令仅在导入 IDL 文件时有效,而我只有一个 DLL 和 TLB。我不能使用importlib
,因为这只适用于library
定义。MIDL 编译器不理解 Microsoft 的 C++ import
、importidl
和importlib
属性。
该怎么办?