The most important difference is that an EXE is a program that can be run by the user or by another program. When you run an EXE it loads it into memory and then loads any DLLs it uses and calls the EXE’s main procedure. Although EXEs and DLLs share the same format, the OS will not allow a DLL to be executed.
A DLL is not meant to be run. It is a library. It is a collection of procedures and data that can be used by other code modules (by EXEs and other DLLs).
Is the ordinary EXE same as static linked library ?
Not at all. An EXE is not a library in any sense. A library is a collect of code ot data that can be used by other code. An EXE cannot be used in this way. A DLL can, thus a DLL is a library, but not a static linked library.
A DLL is basically a repository for shared code. The benefit of using DLL’s is that if 8 programs (EXE’s) use the same function, with a DLL, the binary code is only loaded into memory once and all 8 programs attach to the DLL, so it reduces the memory footprint some. As an example, the common dialogs (File Open, File Save, etc.) reside in a DLL. If these were statically linked, each program would have its own copy of all of the common dialogs, and would increase its memory footprint accordingly.
An EXE is loading into memory when somone wants to run it. That could be the user, or another program. A DLL is loaded when an EXE or DLL is loaded that uses it (EXE when loaded with LoadLibrary). When the DLL is loaded it does not “run” like and EXE runs. It sort of just “sits there” and waits for other code modules to use the procedures and data it provides.
so where is the advantage ?
There is no advantage, they serve different purposes. The EXE is a program It is the ultimate goal of programming. it is something useful to the user. A DLL is a library that can be used to make useful EXEs but by themselves they are useless. In the end an EXE is necessary to make the the DLL do userful things.