Difference Between LIB and DLL
LIB vs DLL
When developing software, we are often asked whether we want to use LIB or DLLs in containing functions for the application. LIB is a static library where functions and procedures can be placed and called as the application is being compiled. A DLL or Dynamic Link Library does the same function but is dynamic in a sense that the application can call these libraries during run-time and not during the compilation. This presents a few significant advantages compared to using LIB.
For starters, you would have a single file that is significantly bigger as it contains all of the code while you would have multiple smaller files when using DLL. Compiling your functions and procedures would also allow you more reusability as once you are happy with the functions on the DLL because you can keep it as is with each version of the application and not have to mess with it. You can also use the same DLL if you want to create another application that uses the same functions and procedures. You can directly link to the DLL rather than copy the code from the source as you would need to do with LIB.
A problem with DLL is when you change the content of the DLL. This can lead to versioning problems where an application uses the incorrect version of the DLL causing problems. You need to keep track of your DLLs in order to avoid these problems. You would not have this problem with LIB as you would only get one large file.
When developing the software and choosing DLL, you would still have a LIB file in your project. But unlike when using LIB, this file does not contain the code of the functions and procedures but only stubs that the program needs to call the procedures from the DLL’s.
Summary:
1. A DLL is a library that contains functions that can be called by applications at run-time while LIB is a static library whose code needs to be called during the compilation
2. Using LIB would result in a single file that is considerable bigger while you end up with multiple smaller files with DLL’s
3. DLL’s are more reusable than LIBs when writing new versions or totally new applications
4. DLL files can be used by other applications while LIB files cannot
5. DLL’s are prone to versioning problems while LIB is not
6. You would still have a LIB file when developing software with DLLs but it only contains stubs.
1. A DLL is a library that contains functions that can be called by applications at run-time while LIB is a static library whose code needs to be called during the compilation
2. Using LIB would result in a single file that is considerable bigger while you end up with multiple smaller files with DLL’s
3. DLL’s are more reusable than LIBs when writing new versions or totally new applications
4. DLL files can be used by other applications while LIB files cannot
5. DLL’s are prone to versioning problems while LIB is not
6. You would still have a LIB file when developing software with DLLs but it only contains stubs.
Comments
Post a Comment