您可以使用單一的 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 資料類型的封送處理 和 產生型別庫所需的其他檔案。