首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用大量IDL接口管理COM类型库中的定义

使用大量IDL接口管理COM类型库中的定义
EN

Stack Overflow用户
提问于 2010-07-17 01:37:52
回答 1查看 379关注 0票数 0

我正在创建一个有一百多个接口的COM类型库。在单个library中定义所有接口和coclasses是不合理的……IDL文件变得有数千行那么长!因此,我尝试将每个接口放在其自己的文件中,并使用import来满足其依赖关系。

我可以使用什么策略来管理这么多接口?我尝试在所有地方使用import指令,但我在尝试将它们包含在TLB中时被卡住了。我尝试过在library中使用#include,但是依赖项似乎变得很时髦。

ExampleA.idl

代码语言:javascript
复制
import "oaidl.idl", "ocidl.idl";
[ uuid(...) ] interface IExampleA : IDispatch { ... }

ExampleB.idl

代码语言:javascript
复制
import "oaidl.idl", "ocidl.idl", "IExampleA.idl";
[ uuid(...) ] interface IExampleB : IExampleA { ... }

ExampleLibrary.idl

代码语言:javascript
复制
// 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?
};
EN

回答 1

Stack Overflow用户

发布于 2010-07-17 05:12:32

我认为你将接口分割成多个tlb文件的计划很好,但是我不明白为什么你似乎要手动生成这些文件?

我的建议是将界面分成多个类型库,但使用类型库编辑器来创建它们。

每个版本的Delphi都附带一个类型库编辑器,但是如果你没有这个编辑器,网上应该有一些。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3267463

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档