[.net] difference between a .dll and .lib file!!

Started by
2 comments, last by Sneftel 18 years, 4 months ago
Can anybody please help me in understanding the core differences between a .lib file and .dll file. how windows operating system takes care of these and co-ordinate between the two. how is this mechanism different in case of MFC and .NET environments. i know a detailed discussion might be out of scope in this forum, it would be really helpful for me if anybody has some resources or links to them. i tried to search on google, but didnt get much nice explainations.
Advertisement
I just skimmed this but I hope it helps:
http://www.devhood.com/tutorials/tutorial_details.aspx?tutorial_id=617

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin

My understanding is limited. But from what i know, a lib is never touched by the windows operating system, its simply a file to be linked with at compile time (for msvc, wheras borland and gcc use *.a (again, this is my understanding) ) A DLL is a file loaded at runtime by windows, which contains code for execution, and you retrieve pointers to the functions of the dll(well they're loaded into memory) so that you can later call them (GetProcAddress())

hope that helps a little
cheers
-Dan
When General Patton died after World War 2 he went to the gates of Heaven to talk to St. Peter. The first thing he asked is if there were any Marines in heaven. St. Peter told him no, Marines are too rowdy for heaven. He then asked why Patton wanted to know. Patton told him he was sick of the Marines overshadowing the Army because they did more with less and were all hard-core sons of bitches. St. Peter reassured him there were no Marines so Patton went into Heaven. As he was checking out his new home he rounded a corner and saw someone in Marine Dress Blues. He ran back to St. Peter and yelled "You lied to me! There are Marines in heaven!" St. Peter said "Who him? That's just God. He wishes he were a Marine."
A .lib is a compiler thing. It's just a bunch of precompiled but not linked source files which, at link time, you can pull in to your own application. It allows you to use a body of library functionality without having to recompile it, and without having the source code.

A .dll is an operating system thing. It's a bunch of precompiled and linked code which, at runtime, you can pull in to your application. It allows you to use a body of library functionality which is in a separate file, and which can be shared by multiple applications.

To make things more confusing, .dlls usually have attendant .lib files, called "import libraries", to make them easier to use.

This topic is closed to new replies.

Advertisement