FAQ 34.29 What are the benefits of using type libraries?

graphics/new_icon.gif

Discover type information for a COM class without having to load the class.

A type library is the Automation standard for describing the objects, properties, and methods exposed by an Automation object. Type libraries provide important benefits.

  • Type checking can be performed at compile time. This helps developers of Automation callers to write fast, correct code to access objects.

  • Type browsers can scan the type library, allowing others to see the characteristics of the classes.

  • Browsers and compilers can use the type information to display and access the classes.

  • Automation callers that cannot use vtable interfaces can read and cache DISPIDs at compile time, improving runtime performance.

  • Visual Basic applications can take advantage of early binding by creating objects with specific interface types, rather than the generic Object type.

  • Implementation of IDispatch::Invoke for the interface is faster and easier.

  • Access to out-of-process servers is improved because Automation uses information from the type library to package the parameters that are passed to an object in another process.

Another benefit of type libraries is type library marshaling. Type library marshaling allows a custom interface to use the built-in Automation marshaler for the IDispatch interface, thus avoiding the need to build a proxy/stub DLL for the custom interface and then having to register it on each machine the Automation marshaler is automatically available on Windows machines. To use this option, you need only register a type library for the interface on the client machines and restrict the interface to using the Automation compatible data types (see FAQ 34.32).



C++ FAQs
C Programming FAQs: Frequently Asked Questions
ISBN: 0201845199
EAN: 2147483647
Year: 2005
Pages: 566
Authors: Steve Summit

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net