PC Review


Reply
Thread Tools Rate Thread

tlbexp command

 
 
=?Utf-8?B?R2Vvcmdl?=
Guest
Posts: n/a
 
      11th Sep 2007
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
 
Reply With Quote
 
 
 
 
Brian Muth
Guest
Posts: n/a
 
      11th Sep 2007

"George" <(E-Mail Removed)> wrote in message news:B334F3B5-E321-4580-BD7E-(E-Mail Removed)...
> 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?


Correct.

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


Not all COM DLL's have a type library. If one exists, it might be a separate file or it may be embedded as a resource. You can find
out by using Oleview. Click on "File", "View Typelib..." and opening the DLL.

Brian


 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2Vvcmdl?=
Guest
Posts: n/a
 
      12th Sep 2007
Thanks Brian,


When using OLEView to open the native unmanaged COM DLL, there is an error
message.

LoadTypeLib (c:\temp\foo.dll) failed.

Error loading type library/DLL.

TYPE_E_CANTLOADLIBRARY ($80029C4A)

Do you know what is wrong?


regards,
George

"Brian Muth" wrote:

>
> "George" <(E-Mail Removed)> wrote in message news:B334F3B5-E321-4580-BD7E-(E-Mail Removed)...
> > 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?

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

>
> Not all COM DLL's have a type library. If one exists, it might be a separate file or it may be embedded as a resource. You can find
> out by using Oleview. Click on "File", "View Typelib..." and opening the DLL.
>
> Brian
>
>
>

 
Reply With Quote
 
Ben Voigt [C++ MVP]
Guest
Posts: n/a
 
      12th Sep 2007

"George" <(E-Mail Removed)> wrote in message
news:7D44BE94-6CB1-4A7B-8DDF-(E-Mail Removed)...
> Thanks Brian,
>
>
> When using OLEView to open the native unmanaged COM DLL, there is an error
> message.
>
> LoadTypeLib (c:\temp\foo.dll) failed.
>
> Error loading type library/DLL.
>
> TYPE_E_CANTLOADLIBRARY ($80029C4A)
>
> Do you know what is wrong?


Looks like the type library is not embedded in the DLL. To verify, open the
DLL in Visual Studio's resource editor, if there are any type libraries they
will show up as custom resources of class "TYPELIB".


>
>
> regards,
> George
>
> "Brian Muth" wrote:
>
>>
>> "George" <(E-Mail Removed)> wrote in message
>> news:B334F3B5-E321-4580-BD7E-(E-Mail Removed)...
>> > 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?

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

>>
>> Not all COM DLL's have a type library. If one exists, it might be a
>> separate file or it may be embedded as a resource. You can find
>> out by using Oleview. Click on "File", "View Typelib..." and opening the
>> DLL.
>>
>> Brian
>>
>>
>>



 
Reply With Quote
 
=?Utf-8?B?R2Vvcmdl?=
Guest
Posts: n/a
 
      13th Sep 2007
Thanks Ben,


I have followed your approach and I think there is no typelib embedded in
the DLL. I am not using ATL and MFC, and developing unmanaged native C++ COM
DLL from scratch.

In my situation, how to generate type library? I am using Visual Studio 2005.


regards,
George

"Ben Voigt [C++ MVP]" wrote:

>
> "George" <(E-Mail Removed)> wrote in message
> news:7D44BE94-6CB1-4A7B-8DDF-(E-Mail Removed)...
> > Thanks Brian,
> >
> >
> > When using OLEView to open the native unmanaged COM DLL, there is an error
> > message.
> >
> > LoadTypeLib (c:\temp\foo.dll) failed.
> >
> > Error loading type library/DLL.
> >
> > TYPE_E_CANTLOADLIBRARY ($80029C4A)
> >
> > Do you know what is wrong?

>
> Looks like the type library is not embedded in the DLL. To verify, open the
> DLL in Visual Studio's resource editor, if there are any type libraries they
> will show up as custom resources of class "TYPELIB".
>
>
> >
> >
> > regards,
> > George
> >
> > "Brian Muth" wrote:
> >
> >>
> >> "George" <(E-Mail Removed)> wrote in message
> >> news:B334F3B5-E321-4580-BD7E-(E-Mail Removed)...
> >> > 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?
> >>
> >> Correct.
> >>
> >> >
> >> > I am wondering how to export tlb file of an unmanaged C++ COM DLL?
> >>
> >> Not all COM DLL's have a type library. If one exists, it might be a
> >> separate file or it may be embedded as a resource. You can find
> >> out by using Oleview. Click on "File", "View Typelib..." and opening the
> >> DLL.
> >>
> >> Brian
> >>
> >>
> >>

>
>
>

 
Reply With Quote
 
Carl Daniel [VC++ MVP]
Guest
Posts: n/a
 
      13th Sep 2007
George wrote:
> Thanks Ben,
>
>
> I have followed your approach and I think there is no typelib
> embedded in the DLL. I am not using ATL and MFC, and developing
> unmanaged native C++ COM DLL from scratch.
>
> In my situation, how to generate type library? I am using Visual
> Studio 2005.


You have to build a type library using the MIDL compiler. You can then
embed that type library as a resource, or keep it as a separate file.

-cd


 
Reply With Quote
 
SvenC
Guest
Posts: n/a
 
      13th Sep 2007
Hi George,

> I have followed your approach and I think there is no typelib embedded in
> the DLL. I am not using ATL and MFC, and developing unmanaged native C++
> COM
> DLL from scratch.


Do you use an idl file to specify your library, coclasses and interfaces?
If yes, that idl must be compiled with midl.exe which will create the type
library.

> In my situation, how to generate type library? I am using Visual Studio
> 2005.


If you are using Visual Studio, why don't you use ATL and its wizards for
creating COM objects?

--
SvenC

 
Reply With Quote
 
=?Utf-8?B?R2Vvcmdl?=
Guest
Posts: n/a
 
      13th Sep 2007
Thanks cd,


I think I should use MIDL compiler and use the COM DLL as input to generate
type lib, right?

Do you have any reference materials about how to use MIDL compiler to
generate type lib and embedded it into COM DLL?


regards,
George

"Carl Daniel [VC++ MVP]" wrote:

> George wrote:
> > Thanks Ben,
> >
> >
> > I have followed your approach and I think there is no typelib
> > embedded in the DLL. I am not using ATL and MFC, and developing
> > unmanaged native C++ COM DLL from scratch.
> >
> > In my situation, how to generate type library? I am using Visual
> > Studio 2005.

>
> You have to build a type library using the MIDL compiler. You can then
> embed that type library as a resource, or keep it as a separate file.
>
> -cd
>
>
>

 
Reply With Quote
 
=?Utf-8?B?R2Vvcmdl?=
Guest
Posts: n/a
 
      13th Sep 2007
Thanks SvenC,


I am using Visual Studio 2005 and I can not find any idl file in the project
directory. Could you let me know how to generate type lib through MIDL
compiler please?

BTW: for some legacy reasons to maintain some code, I can not use ATL or MFC.


regards,
George

"SvenC" wrote:

> Hi George,
>
> > I have followed your approach and I think there is no typelib embedded in
> > the DLL. I am not using ATL and MFC, and developing unmanaged native C++
> > COM
> > DLL from scratch.

>
> Do you use an idl file to specify your library, coclasses and interfaces?
> If yes, that idl must be compiled with midl.exe which will create the type
> library.
>
> > In my situation, how to generate type library? I am using Visual Studio
> > 2005.

>
> If you are using Visual Studio, why don't you use ATL and its wizards for
> creating COM objects?
>
> --
> SvenC
>

 
Reply With Quote
 
SvenC
Guest
Posts: n/a
 
      13th Sep 2007
Hi George,

> I am using Visual Studio 2005 and I can not find any idl file in the
> project
> directory. Could you let me know how to generate type lib through MIDL
> compiler please?
>
> BTW: for some legacy reasons to maintain some code, I can not use ATL or
> MFC.


You could create an ATL test project which does create an idl and will also
create/configure the necessary midl compiler settings. That should help you
to build the necessary idl for your legacy project.

You will find information about IDL files and the midl compiler in the MSDN.

--
SvenC

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Question with tlbExp =?Utf-8?B?S3JpdGlWZXJtYUBob3RtYWlsLmNvbQ==?= Microsoft Dot NET 0 8th Dec 2004 05:13 PM
Article : Tlbexp .exe and Regasm.exe (.Net FrameWork Tools Series) Namratha Shah \(Nasha\) Microsoft Dot NET Framework 0 5th Nov 2004 07:31 AM
Problem with .NET Array and TlbExp (10/12) tcarvin Microsoft Dot NET 1 13th Oct 2004 01:30 PM
is tlbexp working properly? Buddhike de Silva Microsoft Dot NET Framework 0 28th Nov 2003 04:19 AM
tlbexp BUG? Buddhike de Silva Microsoft Dot NET Framework 0 28th Nov 2003 04:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:26 AM.