Difference between .dll and .exe?

后端 未结 15 1157
有刺的猬
有刺的猬 2020-12-02 04:23

I want to know the exact difference between the dll and exe file.

15条回答
  •  [愿得一人]
    2020-12-02 04:54

    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

    1. An exe always runs in its own address space i.e., It is a separate process.
    2. The purpose of an EXE is to launch a separate application of its own.

    DLL

    1. A dll always needs a host exe to run. i.e., it can never run in its own address space.
    2. The purpose of a DLL is to have a collection of methods/classes which can be re-used from some other application.
    3. 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

提交回复
热议问题