I want to add a method accepting IStream* to my COM interface. Here's the idl excerpt:
import "oaidl.idl";
import "ocidl.idl";
import "objidl.idl";//IStream is declared in this .idl file
[
uuid(uuidhere),
version(1.0)
]
library MyLibrary
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
[
object,
uuid("interfaceid"),
dual,
nonextensible,
oleautomation,
hidden
]
interface IMyInterface : IUnknown {
HRESULT LoadStream( [in] IStream* stream );
HRESULT LoadUnknown( [in] IUnknown* unkn );
};
}
I compile the .idl file and import the typelib in another project.
When I review the .tlb in OLEView file I see that the IStream is declared inside my typelib but IUnknown is not. This causes problems - when I try to call IMyInterface::LoadStream() in another project C++ says it can't convert IStream* to MyLibrary::IStream*. In the same time it doesn't complain about IUnknown.
Why does MIDL put IStream definition inside the typelib and not treat it as a global definition?