Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what are the pros and cons of using a DLL?

Windows still use DLLs and Mac programs seem to not use DLL at all. Are there benefits or disadvantages of using either technique?

If a program installation includes all the DLL it requires so that it will work 100% well, will it be the same as statically linking all the libraries?

like image 463
nonopolarity Avatar asked Jun 02 '09 11:06

nonopolarity


2 Answers

MacOS X, like other flavours of Unix, use shared libraries, which are just another form of DLL.

And yes both are advantageous as the DLL or shared library code can be shared between multiple processes. It does this by the OS loading the DLL or shared library and mapping it into the virtual address space of the processes that use it.

like image 152
cletus Avatar answered Sep 23 '22 23:09

cletus


On Windows, you have to use dynamically-loaded libraries because GDI and USER libraries are avaliable as a DLL only. You can't link either of those in or talk to them using a protocol that doesn't involve dynamic loading.

On other OSes, you want to use dynamic loading anyway for complex apps, otherwise your binary would bloat for no good reason, and it increases the probably that your app would be incompatible with the system in the long run (However, in short run static linking can somewhat shield you from tiny breaking changes in libraries). And you can't link in proprietary libraries on OSes which rely on them.

like image 30
alamar Avatar answered Sep 21 '22 23:09

alamar