I'm creating a COM type library with over one hundred interfaces. Defining all of the interfaces and coclasses in a single library
is unreasonable... the IDL file becomes thousands of lines long! So I'm trying the idea of putting each interface in its own file, and using import
s to satisfy its dependencies.
What strategies can I use to manage this many interfaces? I'm trying to use import
directives everywhere, but I'm stuck trying to get them included in the TLB. I've tried #include
in the library
, but things seem to get funky with dependencies.
ExampleA.idl
import "oaidl.idl", "ocidl.idl";
[ uuid(...) ] interface IExampleA : IDispatch { ... }
ExampleB.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?
};