Lib Vs DLL | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Lib Vs DLL

Hi I have an idea that Lib (static library) is static and DLL(Dynamic Link Library) is dynamic in terms of loading the same... When we change Lib , it is necessary to build projects consuming lib files.... Also lib is embedded in to main application exe and hence binary size is also increased... Where as DLL is loaded as and when required.. Also DLL is shared and once loaded , it will be reused again and no need to be loaded by loader again and again... Where same is not the case with Lib.. Please correct me if any of the above point is wrong.. Having said all these , 1. can I safely assume that in any case DLL is faster compared to Lib? 2. What's the best use of opting Lib over DLL

21st Sep 2021, 7:54 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
3 Answers
+ 5
answering your 2nd question ; from experience, using lib over DLL makes your application harder to reverse engineer,("harder" not impossible) because everything is contained inside the application. -using lib makes your application portable, because you are not linked to a specific version of a lib that is shared across multiple applications. by portable I meant your application will run on different environment whether you use an old or new library. because it doesn't have to care about the shared one.
22nd Sep 2021, 12:15 AM
Bahhaⵣ
Bahhaⵣ - avatar
+ 2
I'm guessing that for 2 the run time load times of DLLs can be avoided using a static library
22nd Sep 2021, 1:29 AM
Sonic
Sonic - avatar
+ 2
As you said for 1 the memory consumed by the application and executable size will be reduced when using a DLL.
22nd Sep 2021, 1:31 AM
Sonic
Sonic - avatar