Difference between EXE and DLL


1. .EXE is an executable file and can run by itself as an application, where as .DLL is usullay consumed by a .EXE or by another .DLL and we cannot run or execute .DLL directly.

2. For example, In .NET, compiling a Console Application or a Windows Application generates .EXE, where as compiling a Class Library Project or an ASP.NET web application generates .DLL. In .NET framework, both .EXE and .DLL are called as assemblies.

3. .EXE stands for executable, and .DLL stands for Dynamic Link Library

If you are aware of any other differences please post them using the form below.

12 comments:

  1. exe has main(..), dll dont

    ReplyDelete
  2. We can make a .dll file (Including Main()),
    But can't make an exe file (without Main())

    ReplyDelete
    Replies
    1. how can we make .dll file without any supporting library. is it possible?

      Delete
  3. exe has an entry point(main).dll does not have since it is library.

    ReplyDelete
  4. 3. .DLL's can be reused, where as .EXE's cannot be reused.

    -- We can reuse EXE files if they are built using .Net Framework. But the above statement says we can not reuse.

    Check yourself. Create a console application write a public class and public method.

    Create another application (any type), add reference to the EXE file directly (Not the project reference in same solution).

    You can access all public types and members from the referenced EXE file.

    ReplyDelete
  5. how to create referenced EXE file
    will this class have main();

    mail me rahulbadola26@gmail.com

    ReplyDelete
  6. when we ad a reference as a dll file for project.We got an error as this not a correct format or like.What is the reason.How that kind of dll been used.

    ReplyDelete
  7. DLL - Dynamic Link Library



    An ActiveX Dll runs is an in process server running in the same memory space as the client process.



    EXE – Executable File


    An ActiveX Exe is an out of process server which runs in its own separate memory space.

    Advantages of ActiveX Dll
    -------------------------
    1) An in-process component shares its client’s address space, so property and method calls don’t have to be marshaled. This results in much faster performance.

    Disadvantages of ActiveX Dll
    ----------------------------
    1) If an unhandled error occurs it will cause the client process to stop operating.

    Advantages of ActiveX Exe
    -------------------------
    1) The component can run as a standalone desktop application, like Microsoft Excel or Microsoft Word, in addition to providing objects.
    2) The component can process requests on an independent thread of execution, notifying the client of task completion using events or asynchronous call-backs. This frees the client to respond to the user.
    3)If an error occurs the client processes can continue to operate.

    Disadvantages of ActiveX Exe
    ----------------------------
    1) Generally slower than an ActiveX dll alternative

    ReplyDelete
  8. DLLs are in-proc while EXE is out-proc.

    Means EXE always runs as a seperate process while Dll runs in the scope of parent process which is consuming the dll.

    ReplyDelete
  9. dll is an executable file, it is linked via runtime for many dependencies

    ReplyDelete
  10. showing error file not found or not a pe file while executing ildasm command

    ReplyDelete

If you are aware of any other C# questions asked in an interview, please post them below. If you find anything missing or wrong, please feel free to correct by submitting the form below.

 
Disclaimer - Terms of use - Contact Us