Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between .dll and .exe?

Tags:

windows

dll

exe

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

like image 363
Umesh Aawte Avatar asked Jul 31 '09 06:07

Umesh Aawte


People also ask

Is a .DLL an executable file?

A DLL file is not by it self executable, though it may contain executable code. A DLL (Dynamic-Link Library) contains code, data, resources etc. usable by other programs. You need an EXE file for the operating system to execute code within DLL files, like "RUNDLL.

What is EXE and DLL in .NET framework?

DLL (Dynamic Link Library) NET Framework when we compile a Console Application or a Windows Application, it generates EXE, whereas when we compile a Class Library Project or ASP.NET web application, then it generates DLL. In.NET framework, both EXE and DLL are called assemblies.

Can DLL be converted to EXE?

DLL to EXE is an Open Source, portable, Command Prompt utility that can convert any DLL to an EXE (executable). If you execute DLL to EXE without first being in the Command Prompt or Powershell, you will be shown the arguments required. Simply put, type in "dll_to_exe filename.

What is a DLL file used for?

A DLL is a library that contains code and data that can be used by more than one program at the same time. For example, in Windows operating systems, the Comdlg32 DLL performs common dialog box related functions. Each program can use the functionality that is contained in this DLL to implement an Open dialog box.


3 Answers

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

like image 123
Aamir Avatar answered Nov 15 '22 23:11

Aamir


EXE:

  1. It's a executable file
  2. When loading an executable, no export is called, but only the module entry point.
  3. When a system launches new executable, a new process is created
  4. The entry thread is called in context of main thread of that process.

DLL:

  1. It's a Dynamic Link Library
  2. There are multiple exported symbols.
  3. 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

like image 30
firstthumb Avatar answered Nov 15 '22 22:11

firstthumb


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.

like image 24
Robin Day Avatar answered Nov 15 '22 22:11

Robin Day