Static libreries (LIB) Vs Dynamic libreries ( DLL) 
Author Message
 Static libreries (LIB) Vs Dynamic libreries ( DLL)

Hi, I don't understand the WHOLE meaning, using, advantage, disadvantage of Dll Vs Lib. Where can I find information about it ?

Please don't try to explain it in couple of sentences because
I basicly know the differents

Thanks All

-----------------** -- Posted from CodeGuru -- **-----------------
http://www.*-*-*.com/ ;  The website for Visual C++ programmers.



Sat, 12 Jan 2002 03:00:00 GMT  
 Static libreries (LIB) Vs Dynamic libreries ( DLL)
A DLL is a dynamic link library.  It gets loaded at run time.  You have
to do some stuff for an application to properly call a DLL, and the DLL
has to be able to properly interact with the calling apps, meaning it
has to have an interface that both can agree on.  Getting that all right
is more than I am willing to type in here just now.  There are plenty of
good books on the subject, and VC comes with quite a bit of doc on it.

The extra work and problems for a DLL are these:
- you do have to do the stuff to call it
- it comes as an extra file, splitting your app in two, so you have more
  configuration managment and version controll problems
- the time to load it is usually a bit longer than a single app (not
always)
- the combined app plus DLL is usually a bit bigger in memory because
  there is some system overhead (again, not always)

The major advantage is that the DLL can be shared across several apps,
meaning common functions   and resources can be shipped once, saving
on the size of an install. This applies on your hard drive, the shipping
disks, on the web site where the app may be stored, etc.  Plus, if two apps
(or more) are open at the same time and using the same DLL, the total
combined size in memory will be less.  This is because the DLL stuff
is only in memory once.  With static linking it would come in once for each
app that uses it. Plus the second (and later) apps don't have to load the
DLL part, so their loads may be quicker.

Another possible advantage is that the DLL can be updated without the
app being updated.  This is where version control gets tricky though.
If you fix or add to something in the DLL, you can replace the DLL then
start the app again.  If all has been done correctly, the new feature
(or bug fixed old feature) will then be available to all apps that use it.

The cannonical example of DLL use is the common dialogs.  This is
a DLL that contains things like the File Open dialog and so on.  These
tend to get used by nearly every app that gets run on Windows.
(Except for special things like Services etc. that don't interact with
the desktop.)  In this case, it makes a lot of sense to put them in a
DLL, because they may be used by a very large number of apps,
possibly many apps loaded at the same time.

On the other hand, if you expect that a feature or resource is only
going to be used by one application it probably does not belong
in a DLL.  Even if as many as two apps will use it, you should do
some experimenting to see if the savings is actually worth it.

And before you dive into making either a DLL or a regular lib,
you should do some reading on library design. It's important to
know what belongs in a lib and what does not.  Basically, you
want stuff in a lib that a group of apps will all use. Thats a bit
over simplified but gets the idea across.

--
Dan Evens
Standard disclaimers etc. No spam please.


Quote:

> Hi, I don't understand the WHOLE meaning, using, advantage, disadvantage

of Dll Vs Lib. Where can I find information about it ?


Sat, 12 Jan 2002 03:00:00 GMT  
 Static libreries (LIB) Vs Dynamic libreries ( DLL)
In MDSN Library -> Technical Articles ->Visual Tools ->Visual C++ -> Visual
C++ 4.0 -> DLL for Beginners, there's a good description of a DLL, LIB, the
difference between them, advantages of using DLL, ...

HTH

Steve

Quote:

> Hi, I don't understand the WHOLE meaning, using, advantage, disadvantage

of Dll Vs Lib. Where can I find information about it ?
Quote:

> Please don't try to explain it in couple of sentences because
> I basicly know the differents

> Thanks All

> -----------------** -- Posted from CodeGuru -- **-----------------
> http://www.codeguru.com/    The website for Visual C++ programmers.



Sat, 12 Jan 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Creation of libreries under MSVC 6

2. Creating static .lib and dynamic .dll

3. Q: dynamic dll vs static library

4. Linking Static DLL vs Non Static DLL

5. Differentiate LIB file for static library and LIB file for DLL

6. Static vs. Dynamic linking

7. Dynamic vs Static memory allocation and when to use it

8. Static Vs Dynamic Allocation.

9. Static vs Dynamic linking

10. Static vs Dynamic link

11. static vs dynamic

12. Static vs Dynamic MFC library

 

 
Powered by phpBB® Forum Software