On Mon, 22 Apr 2013 15:51:58 -0700, BeeJ <
spa...@nospam.com> wrote:
>
>What other advantages do TypeLibs provide.
>
For "WinAPI-type" DLLs, a definition in a type library provides
slightly better performance as a Declare directive carries with it
some overhead.
Using a Declare directive VB introduces additional (hidden) parameter
testing and for lack of a better term - "existence checking". A
typelib eliminates this as this is all done at 'development time'.
This is also often referred to as 'type safety'.
By creating a unique 'library' for each DLL you can make it slightly
easier to resolve name-collisions by simply providing a complete
reference. A la ..
LibA.AddItem()
LibB.AddItem()
Which can occasionally come about in a busy development environment.
[You do this with the Declare directive by using Alias.]
You can also declare Constants, Enums, and UDTs.
Declaring UDTs in a "global" type library allows you to pass them
between classes in VB.
When declaring and defining these items in VB you often have to repeat
the declarations in more than one module. This introduces multiple
opportunities for error. Using a type library allows one to declare
them only once, and in only one place.
Need to change something - go to one IDL file, not employing a
search/replace.
Using a type library you can also provide help information which will
show up in Intellisense.
If you are using a mixed environment such as VC++, Delphi, VB, ...
instead of having different definitions (eg, a header file in one,
Declares in one format or another) all of them can use a type library
for your shared items.
Probably missing something ... <g>
-ralph