PDA

Click to See Complete Forum and Search --> : Help on Type Libraries versus dll


FrancisC
Oct 26th, 2001, 09:41 AM
Could anyone help me figure out what the difference between a type library and a dll is ?

I have a large project on my lap that uses a tlb file with several enums, and several components that use these enums.

I tried to make a modification to one of the enums, and now I can't get my project to run anymore.....

Thanks !

kovan
Oct 26th, 2001, 09:46 AM
Type Libraries are c++ thing
dll are everything thing :)

and dlls are usually faster than type libraries as well they can be used on different applications such as vb, access,
where type libraries are only c++

FrancisC
Oct 26th, 2001, 09:50 AM
I am sure you have your sources... but this project is only VB. I am still not sure why the developper chose a type library, but I know this is being used in VB.....

:eek:

jim mcnamara
Oct 26th, 2001, 10:06 AM
A type library (.tlb) describes both methods & properties as well as interfaces for a COM object. That is all it does. Describe.

It's an actual language, odl, that you compile to make a type libray file. The C++ version of the compiler is idl (or MIDL). VB has one, too. it's called MKTYPLIB.

A type library is what VB Object Browser uses to show properties & methods. A type library can be embedded in a dll or an ocx file.
When you create a VB ActiveX COM object this what happens.
VB buries the type library in the file.

A type library can be standalone. A standalone tlb file can't really do anything except describe. It has no functions. All it does is describe things to other interested programs. It doesn't have any code to support the methods or properties it describes.

hth

FrancisC
Oct 26th, 2001, 10:53 AM
Thanks jim... that helps a lot...

Now, onto my problem... I re-compiled the project that creates that type library (and dll). I was told I was supposed to un-register the dll to be able to use the tlb... that will not work. I don't even get error messages. The application just won't start.

If I don't un-register the dll, I can run the project, but if I look in the references, the dll is referenced in the project, not the tlb anymore...

Does that make sense ? What should I do to get my project running the way it was before ?

:confused:

jim mcnamara
Oct 26th, 2001, 04:12 PM
Okay - I'm confused.

It sounds like you had some kind of COM dll file with a separate tlb file. Then you took the VB project it was made from, recompiled it, or did something like unregister the server - but now, what isn't the same? Specifically, what is broken?

About all you may 'break' is the fact that the external tlb file no longer has anything to do with what VB sees in terms of methods & properties. That it?

jim mcnamara
Oct 26th, 2001, 04:16 PM
Oops my bad. I finally read the first post and understand.

Put those same enums (cut & paste) into the interface definition part of the cls module. That will become part of the embedded type library in the compiled dll. So your enums will work again.

That it? I hope.

FrancisC
Oct 29th, 2001, 07:55 AM
It already is... I think...

The project is OTDREnums.vbp; it contains one class only: clsEnums.cls that looks basically like this:

Option Explicit

Public Enum eMainDbStatus
NoConnection = 0
OffLine = 1
OnLine = 2
End Enum

' Many more Enums here...

Private Sub callthis()

End Sub

Private Sub Class_Initialize()
callthis
End Sub


Thanks for your help !