I have an interface IFoo
that references the Office typelib MSO.DLL
. I want the proxy/stub code (dlldata.c
) to be generated for my interfaces when my IDL is compiled. As I understand it, in order for midl.exe to produce the proxy/stub code, the interface(s) must be declared at the root level of my IDL. However, the importlib
statements can only be within the library
block. Consequently, the type I'm trying to reference (Office._CustomXMLParts
) doesn't exist when IFoo
is compiled. Is there any way to solve this, other than custom proxy/stub implementation or using IDispatch
instead of the full referenced type?
import "oaidl.idl";
import "ocidl.idl";
[
object,
uuid(02F84D34-91DB-400B-94C9-71ABCD6F077D),
version(1.0),
nonextensible,
pointer_default(unique),
oleautomation,
dual
]
interface IFoo : IDispatch
{
[id(0x461A47A4)] HRESULT Bar([in] Office._CustomXMLParts* customXmlParts);
};
[
uuid(CC76135E-FA22-4437-8719-3FFADE38D72B),
version(1.0)
]
library FooLib
{
importlib("stdole2.tlb");
importlib("mso.dll");
interface IFoo;
}
The error I receive is:
error MIDL2025: syntax error : expecting a type specification near "Office"
I tried moving the interface definitions below the library
block, but I get a different error.
error MIDL2009: undefined symbol : _CustomXMLParts [ Parameter 'customXmlParts' of Procedure 'Bar' ]