I noticed that MIDL.exe only generates header file (_h.h) and GUID file (_i.c) for C/C++. Which facilitates creating COM in C/C++.
What if I want to create COM in VB or some other language? IMO, I must define the interface in MIDL language first, and then compile it with MIDL.exe. So how could other languages utilize the output of MIDL.exe?
Many thanks.
Runtime environments like VB6 and .NET treat COM as a first-class citizen and do not require the plumbing that midl.exe provides. A VB6 class is automatically a COM coclass that implements IDispatch. .NET has attributes like [ComVisible]. Their runtime environments implements the glue needed.
No such glue in C++, you have to write it yourself. Or leverage a class library like ATL. It does however allow moving beyond the confines of oleauto, like implementing interfaces that derive from IUnknown and creating custom marshallers.