我正在创建一个具有一百多个接口的 COM 类型库。在单个中定义所有接口和 coclasslibrary
是不合理的...... IDL 文件变成了数千行!所以我尝试将每个接口放在自己的文件中,并使用import
s 来满足其依赖关系。
我可以使用什么策略来管理这么多接口?我试图在import
任何地方使用指令,但我一直试图将它们包含在 TLB 中。我已经尝试过#include
,library
但依赖项似乎变得很时髦。
示例A.idl
import "oaidl.idl", "ocidl.idl";
[ uuid(...) ] interface IExampleA : IDispatch { ... }
ExampleB.idl
import "oaidl.idl", "ocidl.idl", "IExampleA.idl";
[ uuid(...) ] interface IExampleB : IExampleA { ... }
示例库.idl
// Should I put some imports here? They won't be included in the library.
import "IExampleA.idl";
import "IExampleB.idl";
[ uuid(...) ]
library InfrastructureLib
{
// This? Imports in a library don't actually include the types
import "IExampleA.idl";
import "IExampleB.idl";
// Or this? I get class redefinition errors trying #include
#include "IExampleA.idl"
#include "IExampleB.idl"
// Is there another way?
};