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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…