Using tlbexp.exe on a COM dll

Starceaker picture Starceaker · Dec 28, 2010 · Viewed 11.5k times · Source

I am trying to set up communication between Centura and a COM .dll. (Downloaded from http://download.resip.fr for a database import)

Centura requires a .tlb file to be able to communicate to this component. Normally I would use regasm /tlb to generate the .tlb but seeing as it is a COM .dll this is not possible.

I found that I could use tlbexp for .NET dll's: http://msdn.microsoft.com/en-us/library/hfzzah2c(v=vs.80).aspx

I tried this out, knowing it would probably fail (as I have COM .dll). I received this error:

TlbExp : error TX0000 : Could not load file or assembly 'file:///C:\Windows\system32\ResipBcb.dll' or one of its dependencies. The module was expected to contain an assembly manifest.

Using Dependency Walker I noticed two .dll's missing. I found ieshims.dll online but I can't find the wer.dll. See this question.
I don't know if the tlbexp failure has anything to do with this file that is missing?

To sum up, my question is: How do I get a .tlb from this .dll? I can't seem to find any way to extract the .tlb out of this COM .dll.

Best regards
Clint Cambier

Answer

Hans Passant picture Hans Passant · Dec 28, 2010

What you are trying to do only works for .NET assemblies, not native COM servers. The type library for them is almost always embedded inside the DLL. In Visual Studio, use File + Open + File and select the DLL. Open the "TYPELIB" node, right-click the resource (usually 1), Export. Save it to, say, a project directory, use the .tlb filename extension.