从单个 IDL 文件生成代理 DLL 和类型库

可以使用单个 IDL 文件生成代理存根和头文件来封送代码,以及类型库。 为此,请在库块外部定义接口,然后从库块内部引用该接口,如以下示例所示:

//file: AllKnown.idl

[
    object, uuid(. . .), <other interface attributes>
]
interface IKnown : IUnknown 
{
    import "unknwn.idl";
    <declarations, etc. for IKnown interface go here>
};

[
    <library attributes>
]
library KnownLibrary 
{

    //reference interface IKnown:
    interface IKnown;

    //or create a new class:
    [
        <coclass attributes>
    ] 
    coclass KnowMore 
    {
       interface IKnown;
    };
};

有关详细信息,请参阅 封送 OLE 数据类型生成类型库所需的其他文件