4

Question of terminology and classification.

Is DLL an "executable file"?

http://en.wikipedia.org/wiki/Executable

1
  • 4
    Both EXE files and DLL files are in the "Portable Executable" (PE) format. The formal difference is down to one bit in the Characteristics field in the header. If bit 0x2000 is set, it's a DLL. But usually a DLL will also have a list of available functions.
    – MSalters
    May 16, 2013 at 22:55

5 Answers 5

11

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.EXE" or "RUNDLL32.exe" in windows.

2
  • 6
    FYI - Since DLLs do contain executable code, they get scanned by virus scanners.
    – Keltari
    May 16, 2013 at 13:26
  • @Keltari Good point - which is also why you should avoid downloading DLLs from shady places on the web.
    – AcId
    May 16, 2013 at 13:29
6

According to the Wikipedia article a DLL is an executable file.

In computing, an executable file causes a computer "to perform indicated tasks according to encoded instructions," as opposed to a data file that must be parsed by a program to be meaningful.

Taking this definition a DLL is an executable because it contains encoded instructions to perform a task.

The exact interpretation depends upon the use; while the term often refers only to machine code files, in the context of protection against computer viruses all files which cause potentially hazardous instruction execution, including scripts, are conveniently lumped together.

This is also true for DLLs.

But some might argue that a DLL cannot run by itself, it always needs some program which loads the DLL and calls a function exported by the DLL, so in a strict sense you might also say that only exe-files (if on Windows) are executable files. As Wikipedia says...

The exact interpretation depends upon the use

I would try to use terms or phrases that make it more clear and avoid speaking of executable files if it is not clear in the given context if DLLs are included or not. Even at my work (software developer) I'ld not be sure that everyone always would agree that "executable files" also means DLLs.

3
  • 1
    "According to the Wikipedia article a DLL is an executable file" - actually, it doesn't say that. You are making the common logic mistake of confusing necessary and sufficient conditions. That wikipedia quote states that having executable code is a necessary condition for something to be an executable file, not that it is a sufficient condition. May 16, 2013 at 20:59
  • @BlueRaja And which sufficient condition did you see in the Wikipedia article? What do you think the Wikipedia article says about DLL files? May 17, 2013 at 9:27
  • 1
    The phrase an executable file causes a computer "to perform indicated tasks according to encoded instructions" describes a sufficient condition, not a necessary one. So, it says "is an executable file => contains machine code," which is not the same thing as the statement you're confusing it for, "contains machine code => is an executable file." I'm not sure why you're bringing up the article on DLL's, as you did not reference that one at all (you quoted the article on executable files) May 17, 2013 at 16:53
2

No they aren't, even if they use a similar file format, DLLs are a kind of storage place where you can put anything useful to your executable. The executable will link to the DLL and load object code, icons, and many other things.

4
  • You can put the very same things inside an .EXE as well. Both use the "Portable Executable" (PE) format.
    – MSalters
    May 16, 2013 at 22:50
  • 1
    @Spack: I disagree. A DLL is executable as it contains executable code. As apposed to an object file, a script, or some other form of code. As MSalters replied, an EXE can contain all the things you mentioned.
    – galford13x
    Sep 23, 2014 at 23:29
  • A DLL doesn't have an entry point, whereas an executable does.
    – AStopher
    Feb 9, 2020 at 15:01
  • Well, there's dllmain..
    – user785939
    Aug 27, 2020 at 18:13
2

DLL files contain executable code, but it's not all-sufficient.

Usually, DLL file contains library functions, helpers.

0

Wikipedia articles are not authoritive. The Wikipedia requires other authorities. A good authority for the definition of executable relative to DLLs would be the Microsoft documentation, such as Dynamic-Link Libraries (Dynamic-Link Libraries) - Win32 apps | Microsoft Docs.

Originally in the time before dynamic linking there was only static linking. Compilers such as C and C++ compilers would generate an object file for each source file read in. They still do. Then the object files are linked together into an executable file. But the executable is created from one or more object files. For convenience it is possible to put object files into a library that can be statically linked by the link editor. A dynamic link library is an extension of static libraries where the library file is used by the link editor but the executable code exists in a separate file for use during execution. Therefore a dynamic link library is designed to contain executable code as much as the main executable file that calls all the DLLs it uses, either directly or indirectly.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .