-1

I stumbled upon a question that about the exact difference between an assembly, a DLL, and an EXE file.

Is the following statement correct?

If a DLL has a main method then it becomes an executable? (EXE)

George Stocker
  • 56,270
  • 29
  • 173
  • 234
rp4361
  • 423
  • 1
  • 5
  • 17
  • 6
    This question is not a duplicate of the [suggested question](http://stackoverflow.com/questions/674312/difference-between-assembly-and-dll). This question is "true or false: if a DLL has a main method then it is an executable", and the answer is "false". The suggested question is "what's the difference between an assembly and a DLL?" – Eric Lippert Mar 25 '13 at 16:05

1 Answers1

12

Is the following statement correct: If a DLL has a main method then it becomes an executable?

That statement is incorrect.

Both DLL and EXE files use the PE file format. The difference between a DLL and an EXE is that a DLL has flag 0x2000 set in the Characteristics field of the IMAGE_FILE_HEADER section.

More details can be found here:

Peering Inside the PE: A Tour of the Win32 Portable Executable File Format by Matt Pietrek

svick
  • 225,720
  • 49
  • 378
  • 501
Eric Lippert
  • 630,995
  • 172
  • 1,214
  • 2,051