tags:

views:

290

answers:

4
+2  Q: 

COM typelib doubt

A type library declares the classes, interfaces, constants, and procedures that are exposed by an application or dynamic-link library (DLL). A type library is usually a resource in a program file; it can also be a stand-alone binary file with the extension .tlb or .olb.

So is it possible that some DLL still expose interfaces without being as declared as TypeLib.

Actually I am trying to open a dll from oleview and its showing error message "error loading type library".

As per my understanding if we have interfaces exposed from a DLL then it should be open by oleview, otherwise it cannot have exposed interfaces or functions.

Any possibility that we have dll exposing interfaces and still can't be viewed by Oleview.

A: 

It's possible that the type library could be unviewable by OleView - this is not exactly the worlds most stable software. That is not to say that there is not a type library, or that the interfaces thus defined would be unusable.

1800 INFORMATION
A: 

... is it possible that some DLL still expose interfaces without being as declared as TypeLib.

Yes. You can have a COM DLL with no tlb (though it's not what VC++ manufactures for you by default in ATL projects, for example).

Any possibility that we have dll exposing interfaces and still can't be viewed by Oleview.

Just a wild guess (not sure it's even correct to suggest) but could your DLL contain a tlb that references an external TLB that it fails to locate?

Also, your TLB might contains unsupported (perhaps custom) types that OLEView simply fails to digest. Is it purely a dual-interface sort of DLL?

Assaf Lavie
A: 

First, you should open the library with File->View Typelib, not by pressing the toolbar button. This is a typical error.

Then, you can easily have an in-proc COM server without a typelib in the resources, but late binding and default marshaling will not work for it, otherwise it will be functioning allright. It's typical to do so when you implement a set of externally defined interfaces (like IFilter for example) and know for sure that noone will use neither late binding nor marshaling with you COM server.

sharptooth
+1  A: 

It is possible to create anonymous COM components and also components that only support IUnknown and private interfaces. There is no strict requirement that all of the information for the component should be defined in a type library. The type library just makes things easier for those who are trying to integrate the component and provides layout and other information for COM.

Also note that sometimes script-compatible components (IDispatch, IDispatchEx) only support run-time information, so these will usually ship with a bare-bones type library or none at all. But, with components that expose these interfaces, you can interrogate them through those interfaces for information.

Finally, OleView uses ITypeLib / ITypeInfo to examine type information. Not all COM libraries will provide an implementation, and some may choose to store the information in a separate location.

meklarian