Chapter 14: Type Libraries
In addition to implementing dual interfaces, you should create a type library for each set of objects you expose. Because VTBL references are bound at compile time, exposed objects that support VTBL binding must be described in a type library.
Type libraries provide these important benefits:
- Type checking can be performed at compile time, helping developers of OLE Automation controllers to write fast, correct code to access your objects.
- You can use the DispInvoke function to implement IDispatch automatically. Using DispInvoke ensures that your implementation will be correct.
- Visual Basic applications can create objects with specific interface types, rather than the generic Object type, and take advantage of early binding.
- OLE Automation controllers that don't support VTBLs can read and cache DISPIDs at compile time, thereby improving run time performance.
- Type browsers can scan the library, allowing others to see the characteristics of your objects.
- The RegisterTypeLib function can be used to register your exposed objects.
- Local server access is improved, because OLE Automation uses information from the type library to package the parameters passed to an object in another process.