-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
  • 57,289
  • 29
  • 176
  • 237
rp4361
  • 433
  • 1
  • 5
  • 20
  • 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
  • 236,525
  • 50
  • 385
  • 514
Eric Lippert
  • 647,829
  • 179
  • 1,238
  • 2,067