I have two type libraries with COM interfaces that I wrote using ATL and Microsoft's IDL. I would like an interface in one library to inherit from an interface in the other.
Essentially, I would like to do the same thing that Steven described at How do I create interface methods using .tlb types in VS C++?. The only person who answered him did not seem to understand the question.
Here's what I'd like to do, in code:
SomeLibrary DLL/TLB
ISomeInterface.idl
interface ISomeInterface : IDispatch { ... };
SomeLibrary.idl
import "ISomeInterface.idl";
library SomeLibrary
{
interface ISomeInterface;
};
SomeOtherLibrary DLL/TLB
ISomeOtherInterface.idl
// What do I put here so that the MIDL compiler knows
// what to do when it encounters the ISomeInterface type?
interface ISomeOtherInterface : ISomeInterface { ... };
SomeOtherLibrary.idl
import "ISomeOtherInterface.idl";
library SomeOtherLibrary
{
interface ISomeOtherInterface;
};
The MIDL import
directive only works when importing IDL files, and I only have a DLL and TLB. I can't use importlib
because that only works within a library
definition. The MIDL compiler doesn't understand Microsoft's C++ import
, importidl
, and importlib
attributes.
What to do?