Difference between .dll and .exe?
EXE:
- It's a executable file
- When loading an executable, no export is called, but only the module entry point.
- When a system launches new executable, a new process is created
- The entry thread is called in context of main thread of that process.
DLL:
- It's a Dynamic Link Library
- There are multiple exported symbols.
- The system loads a DLL into the context of an existing process.
For More Details: http://www.c-sharpcorner.com/Interviews/Answer/Answers.aspxQuestionId=1431&MajorCategoryId=1&MinorCategoryId=1 http://wiki.answers.com/Q/What_is_the_difference_between_an_EXE_and_a_DLL
Reference: http://www.dotnetspider.com/forum/34260-What-difference-between-dll-exe.aspx
I don't know why everybody is answering this question in context of .NET. The question was a general one and didn't mention .NET anywhere.
Well, the major differences are:
EXE
- An exe always runs in its own address space i.e., It is a separate process.
- The purpose of an EXE is to launch a separate application of its own.
DLL
- A dll always needs a host exe to run. i.e., it can never run in its own address space.
- The purpose of a DLL is to have a collection of methods/classes which can be re-used from some other application.
- DLL is Microsoft's implementation of a shared library.
The file format of DLL and exe is essentially the same. Windows recognizes the difference between DLL and EXE through PE Header in the file. For details of PE Header, You can have a look at this Article on MSDN
The difference is that an EXE has an entry point, a "main" method that will run on execution.
The code within a DLL needs to be called from another application.