Click to See Complete Forum and Search --> : tlbexp command


George2
September 11th, 2007, 02:30 AM
Hello everyone,


I find that we can use tlbexp command like *tlbexp <dll name>* to export tlb file for a C# COM assembly, but can not use it to export tlb file for an unmanaged C++ COM DLL. Is that correct?

I am wondering how to export tlb file of an unmanaged C++ COM DLL?


thanks in advance,
George

kirants
September 11th, 2007, 12:20 PM
You need to use MIDL compiler to generate the tlb from the odl/idl files. This step is typically done as a part of compilation of the unmanaged COM dll itself.

George2
September 12th, 2007, 07:17 AM
Thanks kirants,

You need to use MIDL compiler to generate the tlb from the odl/idl files. This step is typically done as a part of compilation of the unmanaged COM dll itself.

I find there is no odl/idl file generated for the unmanaged C++ COM DLL. I am using Visual Studio 2005, do I need to setup some options for the compiler or linker to generate odl/idl file?


regards,
George

kirants
September 12th, 2007, 12:08 PM
No. The odl/idl file is not a generated file. It is a file that probably is a part of the project. It is needed if you want to export the class definition to a tlb file.

If the COM dll was created using ATL or MFC, an .odl/.idl file is typically generated by the appwizard. Please search your project directory for .odl/.idl files.

George2
September 12th, 2007, 11:31 PM
Thanks kirants,


No. The odl/idl file is not a generated file. It is a file that probably is a part of the project. It is needed if you want to export the class definition to a tlb file.

If the COM dll was created using ATL or MFC, an .odl/.idl file is typically generated by the appwizard. Please search your project directory for .odl/.idl files.

I am not using ATL and MFC. I developed COM from pure Visual Studio C++ project.

In my situation, how to generate odl/idl?


regards,
George

kirants
September 13th, 2007, 12:02 PM
Just to clarify,


have you written a dll that exports the following functions ?

DllCanUnloadNow @1 PRIVATE
DllGetClassObject @2 PRIVATE
DllRegisterServer @3 PRIVATE
DllUnregisterServer @4 PRIVATE
Have you generated your own class guids and the interface IIDs ? If, so please provide the details of the GUID and the class methods.

George2
September 15th, 2007, 12:27 PM
Yes, kirants. I have implemented and have a .def file for the functions. Could you advise how to generate related idl file please?


regards,
George

Just to clarify,


have you written a dll that exports the following functions ?

DllCanUnloadNow @1 PRIVATE
DllGetClassObject @2 PRIVATE
DllRegisterServer @3 PRIVATE
DllUnregisterServer @4 PRIVATE
Have you generated your own class guids and the interface IIDs ? If, so please provide the details of the GUID and the class methods.

kirants
September 18th, 2007, 07:51 PM
You will have to work backwards.
Your best bet would be to use a wizard to generate this one and stick in your GUIDs/IIDs.
Also, you have to make sure your registration code matches the idl contents.