- Generally difference between dll and lib??
- Posted by lis@mail.fh-ulm.de on April 13th, 2005
Hi!
I'm a rookie in programming and I've a current project to do...
But before I can start to handle this project I've got to know some
generally facts about a dll and a lib. I was searching in dozen of
groups and websites... nothing!!
Can anybody explain to me the generally difference between these two
strategies or can anybody post me a reference to a tutorial website???
Thanks in advance!
Cheers,
Babu
- Posted by Niels Dybdahl on April 13th, 2005
1. lib:
Is linked into your application at compiletime
2. DLL version 1:
Is linked to your application at runtime. Usually you interface to the DLL
from your application via a header file and a lib file. The lib file is made
when you create the dll file.
3. DLL version 2:
Is linked dynamically when your application decides to do so. Requires more
code in your application, but your application might be able to run without
the DLL being present (of course without the functionality provided by the
DLL). Usefull for optional modules in your application.
DLLs are nice because you can replace a DLL with a newer version without
relinking the application.
Libs are nice because they are linked into the application, so that they are
never missing or the wrong version.
Niels Dybdahl
- Posted by Scott McPhillips [MVP] on April 13th, 2005
lis@mail.fh-ulm.de wrote:
When you use a lib the code in the lib becomes part of your exe. No
extra files are needed by your users.
When you use a DLL the user must have the DLL file installed. The main
advantage of a DLL is that multiple programs can share it. For example,
most of the operating system code is in DLLs that are shared by all
programs that are running.
--
Scott McPhillips [VC++ MVP]
- Posted by babu on April 18th, 2005
Hi!
Thank you for your answers, but i've one further question regarding
your statement: "...Usually you interface to the DLL from your
application via a header file and a lib file. The lib file is made
when you create the dll file...." My question is: Why do I need a lib
file for my application project? To solve the references, that are
described in the haeder file?
Thanks
Babu
"Niels Dybdahl" <ndy@fjern.detteesko-graphics.com> wrote in message news:<425ceec0$0$344$4d4eb98e@news.dk.uu.net>...
- Posted by Scott McPhillips [MVP] on April 18th, 2005
babu wrote:
Exactly. The lib file that goes with a DLL is very tiny and contains
little more than a jump table.
--
Scott McPhillips [VC++ MVP]
- Posted by ThisIsMe on July 25th, 2006
I believe it's to resolve the compiled symbols, which are decorated as
compared with plain header file function names.
Actually I'm not sure but I think you can just use the .exp file that
Visual Studio generates rather than a lib file, but either way you need
some kind of reference to what be in the dll.
Regarding:
That comment is really only true is you don't change the library's index of
function names (maybe it's virtual functions only, see
http://www.codeproject.com/dll/The_DLL_Hell.asp for details)
By this I mean, if I have
a(int blah);
b(int blah);
c(int blah);
I can change the contents of the functions without recompiling the client
application.
But if I insert a function between a and b or even need to add a new one
then the client app will fail or at the vey least give you really weird
results.
eg
a(int blah);
a1(int blah);
b(int blah);
c(int blah);
If I recompile the dll but not the app, then a call to b() will in fact
execute a1().
The reason for this is that there's a fixed symbol lookup table compiled
into the client app.
lis@mail.fh-ulm.de (babu) wrote in
news:98399f97.0504180111.69b1260d@posting.google.c om: