Thursday, April 8, 2010

Why would you choose an .exe over a .dll ?

5 comments:

Jasmine said...

Certainly yes .Dll is a better choice ...
->.DLL stands for Dynamic-link library and is Microsoft’s implementation of a shared library.
In simple terms a .DLL file will contain logic that other programs will use.
Dll is an Inprocess Components(i.e runs in another application’s process).
A dll can be snapped into anoter application this allows you to wrap up common functionality

->.EXE stands for executable and denotes that a program is executable.
An exe has it own interface.This just means that if you double click on the file a program will run.
EXE is an Out-of-process component(i.e. it runs in its own address space and has an interface).
An .exe code is running in an altogether separate process space.
A EXE can run independently as it is stand-alone component and is never snapped into another process like a .dll

Isha said...

.Exe- is an out-process and it might contain any no of dll's.
.Exe- will always have main() method, which is the entry point for a program to execute.
.Exe - will have an interface, default one is command window.

dll - is an in-process, contains lite weight implemented code which will be used by .exe.
dll - does not contain any interface and main() method.

so that's why we prefer .Exe over a .dll.

Ekta said...

Unlike .exe .dll is not loaded into the RAM together with the main program thus saving space.So a single .dll can be written and can be linked to as many .exe that reuire its functionality.In this sense .dll is a good choice.
On the other hand it does not have its own interface and is in process i.e. it lives in the same address space as that of parent application and if it crashes it takes down parent application which can be considered as a drwaback.
A exe runs independently as it is stand-alone so when .exe invokes a corrupt.exe only the corrupt .exe dies and the parent application still survives.
If we want a common functionality that needs to be used in multiple applications .dll should be preferred as it lets the exe to be smaller in size without having the need to write an already existing functionality.Otherwise an .exe can be vieed as a better choice.

Jasmine said...

I think I agree with what Ekta summed up..... Dll's helps to achieve Resuability and Exe's can be used when we want to achieve Isolation(hiding) of one application from another.

Unknown said...

I would choose an .exe over dll in a case where i would need a user interface or any user activity.

.Exe is self executable(that why it is an out process). .DLL can not run itself but has to snap in the exeutable (that's why its called an in-process)