100 を超えるインターフェイスを備えた COM タイプ ライブラリを作成しています。すべてのインターフェイスとコクラスを 1 つのファイルで定義するのは合理的ではありません。IDLlibrary
ファイルは何千行にもなります。そのため、各インターフェイスを独自のファイルに入れ、import
s を使用してその依存関係を満たすというアイデアを試しています。
この多くのインターフェイスを管理するには、どのような戦略を使用できますか? どこでもディレクティブを使用しようとimport
していますが、それらを TLB に含めようとして行き詰まっています。で試してみ#include
ましたがlibrary
、依存関係がおかしいようです。
例A.idl
import "oaidl.idl", "ocidl.idl";
[ uuid(...) ] interface IExampleA : IDispatch { ... }
例B.idl
import "oaidl.idl", "ocidl.idl", "IExampleA.idl";
[ uuid(...) ] interface IExampleB : IExampleA { ... }
ExampleLibrary.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?
};