This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of
computers,
computing, and
information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join
the discussion and see a list of open tasks.ComputingWikipedia:WikiProject ComputingTemplate:WikiProject ComputingComputing articles
This article is within the scope of WikiProject Microsoft Windows, a collaborative effort to improve the coverage of
Microsoft Windows on Wikipedia. If you would like to participate, please visit the project page, where you can join
the discussion and see a list of open tasks.Microsoft WindowsWikipedia:WikiProject Microsoft WindowsTemplate:WikiProject Microsoft WindowsMicrosoft Windows articles
This article is within the scope of WikiProject Computer Security, a collaborative effort to improve the coverage of
computer security on Wikipedia. If you would like to participate, please visit the project page, where you can join
the discussion and see a list of open tasks.Computer SecurityWikipedia:WikiProject Computer SecurityTemplate:WikiProject Computer SecurityComputer Security articles
which places the DLL's location and its globally unique ID (GUID) in the registry. Programs can then use the DLL by looking up its GUID in the registry to find its location.
This is wrong DLLs don't have GUIDs. A DLL can have one or more components inside and those are the ones that have unique GUIDs. For example:
User:67.10.10.66 introduced many small factual errors in his (obviously good-faith) edits, so I decided to revert them and merge the valuable additions gradually.
E.g. DLLs aren't limited to PE files (they were NE in 16-bit Windows); SYS, DRV and FO? have nothing to do with them, except they are also PE; ordinals are mandatory, while names aren't; and so on.
current directory (if different from executing app)
May add additional directories here with SetDllDirectory
GetDllDirectory retrieves a list of these paths.
Windows system directory
16-bit windows system directory (obsolete)
Windows directory (GetWindowsDirectory)
Directories in the PATH environment variable
SetDllDirectory(NULL) resets the search path to the defaults.
DLL main entry point
Notifications
DLL_PROCESS_ATTACH
DLL_PROCESS_DETACH
DLL_THREAD_ATTACH
DLL_THREAD_DETACH
DisableThreadLibraryCalls disables DLL_THREAD_ATTACH AND DLL_THREAD_DETACH notifications.
DLL process and thread interaction and safety
Semi-standard exported functions
HRESULT CALLBACK DllGetVersion(DLLVERSIONINFO *)
#pragma comment(lib, "Example.lib")
Delay loading DLLs (lazy binding)
#pragma comment(lib, "/DelayLoad:Example.dll")
DLLs in Delphi
Compiler and language considerations
Real project file contents... - ie exports section can be put anywhere, not exactly at the end
Some words about Delphi's specific data type string in libraries (Can be used inside, but when passed in parameter or result, BORLANDMM.DLL must be included to the project. How to obtain this)
Examples
Other directives like index, name, resident
Calling conversions (why cdecl??? stdcall is default, even if there are only soft differences)
Using dll without external directive (LoadLibrary(...), GetProcAddress(...)...)
There's just one thing called Dynamic-Link Library; no disamb needed disamb, if necessary, should go by some other name. --
tyomitch09:19, 4 December 2005 (UTC)reply
Add *Support or *Oppose followed by an optional one sentence explanation, then sign your vote with ~~~~
Support. There is no usage outside of computing, and there are probably several orders of magnitude more people who will use dynamic link library in the context of Microsoft DLLs.
Jsmethers22:11, 4 December 2005 (UTC)reply
Discussion
The article was previously moved from
Dynamic-Link Library to
Microsoft Dynamic Link Library. This is a request to move it back. Most references have already been changed to point to the new locations. Even before the move, there were a large number if errors in the use of Dynamic Link Library. These errors clearly show there is ambiguity in the use of Dyanmic-Link Library alone.
Some used it in the context of Microsoft's implementation and pointed to the generic
shared library page, which contains information about the concept of dynamic linking used in libraries.
Some used it in the context of dynamic linking used in libraries and pointed to the page on Microsoft's implementation.
This change is more or less a focus on a noun-phrase used within the Microsoft subfieled of computing. Microsoft should be added to denote this context.
Microsoft also does not call Windows Microsoft Windows. The context is assumed. The problem is one of how much context should be in the title of a wikipedia article.
The article should be called by the most common use (by orders of magnitude), and a friendly disambiguation link should be added at the top.
Jsmethers22:11, 4 December 2005 (UTC)reply
It focuses on adjective versus adverb and verb tenses. One of the following permutations may be used when writing and speaking about dynamic link libraries.
See
disambiguation, it's a guideline. The most common name used when searching wikipedia should be used as the title of the article. Such searches should not go directly to a disambiguation page.
This article should be moved back.
A friendly link should be placed at the top of the page which points to the disambiguation page.
To put this requested move in context, it would be like asking the
Microsoft Windows be moved to simply
Windows because Microsoft Windows is commonly refered to as just Windows in the Microsoft community.
The article
Dynamic link library is now a redirect to
Microsoft Dynamic Link Library. There may be no need to move this article anymore unless it is desired that the word Microsoft be taken out. In fact, it may be desireable to leave it in this state so that in the furture someone will not come along and move the article again, but simple change the redirect.
I believe that the article should be moved back, namely because the official (per Microsoft Manual of Style for Technical Publications) spelling-out of DLLs is dynamic-link library. (What's more interesting, it's all-lowercase there.) If anyone else decides to participate in this discussion, he is welcome; the discussion is open to everybody. --
tyomitch17:46, 6 December 2005 (UTC)reply
I moved the article to
Dynamic-link library, which happened to be free. In case this is controversial (which is unlikely, given consensus with
User:Jsmethers and no concern from others), perhaps a prior discussion here would be better than breaking out another move conflict. --
tyomitch18:00, 6 December 2005 (UTC)reply
This is a boring terminology versus lexicography debate..
If i understand it correctly, in wikipedia, disambiguation pages are used when a term may refer to several different concepts, and redirections are used when a term is a synonym for a "preferred", unambiguous term that refers to only one concept. When there is no preferred term, or when the preferred term does not refer to only one concept, the wikipedia system doesn't work anymore. In the case of this page, it only talks about the concept of dynamically loaded libraries in the "domain" of Microsoft's operating system, while the concept stays the same on all systems. Since it is very probable that someone searches the term used as the title of this article while looking for a more general explanation of the concept, i think it should at least refer to
Dynamic library (disambiguation) or
Dynamic library or simply the broader concept of
Library (computer_science) (there really is mess on the former two links).
This article should talk about Dynamic-link libraries in general (as they exist in windows, os/2, linux, unix, etc...), not Microsoft's particular vision of them. The current contents of this article should go to a Microsoft-specific article. —Preceding
unsigned comment added by
83.145.93.242 (
talk)
13:16, 19 September 2008 (UTC)reply
Does "disabling caching of dll into memory" help and why? I have too little RAM already and need it used as efficiently as possible. And how to do that?
When you program something, most "things" you do are prewritten. These can be on static libraries or dinamic libraries. The difference between these two is that a static library stores "inside" the .exe, while the DLL stores outside. This may give inconvenients at time of avability, but size of all programs is reduced a lot.
The size of the executable file is reduced with dynamic libraries. The memory footprint for a single process doesn't change for static vs. dynamic libraries, as in modern OS's it's all demand paged either way. The memory footprint for multiple processes can be reduced with DLLs because just one copy of code from a DLL can be used by multiple processes. With static linking all processes need their own copies of the code from the library. i.e. DLLs are good for memory, not bad. "Disabling caching of DLL into memory" is one of the many "tweaks" that are purported to speed things up and usually do the opposite.
Jeh (
talk)
19:30, 7 November 2009 (UTC)reply
GCC
With GCC on Win32, it is possible to write DLLs in the same way that shared objects are written on POSIX systems. For example, consider two files, testlib.h:
#ifndef _TESTLIB_H
#define _TESTLIB_H
extern int test_func(int a, int b);
#endif
And testlib.c:
#include "testlib.h"
int test_func(int a, int b) {
return (a + b);
}
Executing GCC (MinGW) with the following options:
gcc -shared -o testlib.dll testlib.c
Will create a file called "testlib.dll". It can then be linked against any file by including the header "testlib.h" and then passing -L. -ltestlib. I don't know about dynamic loading, but this works for shared linking just fine.—
Kbolino01:55, 15 May 2007 (UTC)reply
Drawback
Is the info about the drawback called "DLL Hell" needed here?
Programming examples
Reading this section of the article, it seems more like a tutorial on how to create DLL's rather than an explanation of what they are specifically. Isn't this generally not encouraged? --
Gafaddict (
talk)
17:56, 21 February 2008 (UTC)reply
Linking to DLL Download sites
I'd like to propose what is already effectively the rule here: no linking to web sites that list DLLs to download. I think all of these violate the
WP:EL linking rules
As Microsoft holds the copyright to most of the DLLs, it would be encouraging downloads from unauthorized distributors
Anyone installing the wrong version of a library is going to make windows even less stable
People installing the libraries won't know about running regsvr against them to register COM objects.
There is a risk that the DLL download is some form of malware
Many (but not all) of the sites appear to be either pay-to-download or scan-your-pc business models.
The definition given for DLL in this article is "DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems".
Well, there is at least one more operating system using DLLs that I know of: Symbian. I know a little bit about them, but I feel that adding that information to the article will result in quite a mess, as the article is heavily Window-based. Any suggestions from someone more experienced than me in editing the Wikipedia?
Jmpep (
talk)
03:25, 14 November 2008 (UTC)reply
Really? Huh... well, let's start with finding some good information, technical details, etc. on DLLs in Symbian. It might be good to create a separate article for the topic. Warren-talk-03:42, 14 November 2008 (UTC)reply
I wrote a section called the "case against DLLs" because virtually all of the dynamic linking articles written in Wikipedia were written by DLL fanboys. The subject is NOT pat, and deserves a counterpoint, which I have written thoughtfully. I have done so before, and the result was having the section clipped out and thrown away. So here is my simple plea: are we presenting all points of view here, or do the fans of one technique or another get to suppress everyone else's viewpoint? DLLs have introduced a lot of unnecessary problems in computing and deserve at least the simple short section I have added, which contains facts and historical background not present in the rest of the article. —Preceding
unsigned comment added by
205.229.50.10 (
talk)
22:05, 15 December 2008 (UTC)reply
...and this is a response to the immediately preceding section here on the talk page, "DLL fanboys":
The problem here is that Wikipedia is not a platform for your point of view... or for mine. A
criticism section (and it's hard to argue that this is not that, given the title) is almost inherently going to contain non-
neutral point of view material. Now as I read the guidelines and policies - and I could be wrong - such material is ok, but if and only if (you knew this was coming) you find
reliable sources that state that point of view, more or less explicitly. And, of course,
cite them.
Better yet, since all WP articles are supposed to present a NPOV, if there is such a criticism section then there should also be an equally well referenced "in favor" section.
As
WP:RS says, Wikipedia articles should cover all major and significant-minority views that have been published by reliable sources (emphasis added).
Note that taking a set of facts (no matter how well referenced) and deriving from them non-NPOV conclusions (whether positive or negative)--e.g. criticism--is not sufficient. This is considered to be
synthesis, a form of
original research. The sources themselves must present the point of view being advanced in the article section.
In any case, it is most definitely not the job of a WP editor to edit articles to include his or her own POV. Accordingly, if no reliable sources are provided for the opinions in this section, I will remove the unsourced material as
original research within 30 days. If these opinions are really that well supported you should have no problem finding sources in that time. Of course, someone less forgiving may remove it sooner. In that case I would recommend that you keep working on the sources, and put the section and the references back in after you find them.
Jeh (
talk)
08:59, 23 December 2008 (UTC)reply
Jeh, please don't just remove the Criticism section, improve it instead! Even Microsoft use the term DLL hell, so I think it is safe to say that there are reputable sources criticising the technology. Somebody who cares more than me just needs to link to them *smiley*
I've made a start by vigorously cutting back the section, leaving a stub just summarising a few of the problems with DLLs. If the original author wants to expand on what I left, please give sources, or it will be removed again.
Limeguin (
talk)
08:39, 26 January 2009 (UTC)reply
I agree with "criticism" (in the sense of "DLL's are bad") being misplaced here, however, a separate list of "drawbacks" might improve the article while maintaining neutrality.
- Malicous code injection - replacing a DLL allows to inject malicous code into the context of all processes that load this DLL. This leads to vulnerabilities since DLLs might be loaded from a location with less strict access restrictions than the main executable, or from unexpected locations alltogether (DLL load order).
- Breaking backwards compatibility - Updating a DLL may subtley change behavior of the contained code and thus break other programs that rely on the DLL
- (Windows specific) Cooperative dependency model through which one application setup may break other applications, lack of a standard versioning mechanism, both of which I'd expect ot be discussed in depth on
DLL Hell.
I came here looking for criticism of DLLs and was disappointed. What is the main purpose of DLLs? "To reduce memory use and software bloat." It seems they fail at both of those, as well as introducing new problems. Will come back when I have found reliable sources.
131.242.134.197 (
talk)
04:46, 29 May 2014 (UTC)reply
"It seems they fail at both of those". How do you know? Have you tested equivalently functional software that didn't use DLLs?
Jeh (
talk)
15:01, 29 May 2014 (UTC)reply
"DLL" is a generic computer science term, Not Microsoft-Specific
Note that with implicit run-time linking, referred to as load-time dynamic linking by Microsoft, if the linked DLL file cannot be found, Windows will display an error message and fail to load the application. The application developer cannot handle the absence of DLL files linked implicitly by the compile-time linker.
This needs correction. Visual C 6.0 and later allows for
Delay-Loaded DLLs, whereby the application can gracefully handle a DLL that is missing at run time.
Mitch Ames (
talk) 2009-07-11T09:50:21
Why is it claimed that the magic number of DLLs is 'MZ'? This is incorrect. Allow me to explain...
A DLL, just like a Windows executable (*.exe) is a PE format executable (PE means Portable Executable). As this article says, even OCX and other extensions are the same thing. The difference between a Windows DLL and an .exe (and all other extensions) is only *one* bit which is different in the PE header.
"The distinction between EXE and DLL files is entirely one of semantics. They both use the exact same PE format. The only difference is a single bit that indicates if the file should be treated as an EXE or as a DLL. Even the DLL file extension is artificial." - Matt Pietrek (
http://msdn.microsoft.com/en-us/magazine/cc301805.aspx)
'MZ' is actually the ASCII character representation of the *DOS* header signature found at the very first address of a PE file. When Windows loads a PE (like a DLL), the programmer can get a hModule handle to it. This is simply a (long pointer) void* address which points to the very first address. This happens to be the DOS signature's address also (DOS magic):
typedefstruct_IMAGE_DOS_HEADER{WORDe_magic;//<- Magic number 1st//... other stuff omitted for clarity// NOTE: All of this is found in 'winnt.h'}
This value is *actually* 0x5A4D (dec. 23117). Converted to ASCII, it is 'MZ' (initials of Mark Zbikowski). But this is still NOT the magic number of the PE format executable. The DOS header is from, you guessed it, the old days of DOS. It's actually a valid DOS executable which can let the user know that Windows is needed to run the code: "This program cannot be run in DOS mode..."
So what is the PE magic number? It's actually defined as 0x00004550 (dec. 17744, and called 'IMAGE_NT_SIGNATURE'). Converted to ASCII characters, this is 'PE00'. This is always checked for when PEs are loaded, parsed, manipulated and executed. My own embedded system checks first for the DOS magic, then for the PE magic before it allows anything else to take place. Windows and other operating systems which handle PEs do the same thing, because this avoids some random hunk of memory being treated like a PE executable (which could be a disaster if it somehow worked).
So, the PE magic number actually looks like this, and is found also in 'winnt.h'
Can we have the article changed to give the correct information to readers? Also, please don't post its ASCII character representation. The magic number is hexadecimal (as usual). It just so happens it was chosen for what it stood for in ASCII, but it's just a hex number (like 0x1BADB002 for the GNU multiboot specification). It should be mentioned that it means 'PE00' in ASCII, but that's not considered the magic number. That is just a character string (or char*) which consists of the same 32 bits. —Preceding
unsigned comment added by
67.142.163.28 (
talk)
11:43, 17 February 2010 (UTC)reply
The .lib file is not required, it's (usually) just for convenience: Instead of the code required for explicit linking (declaring a function pointer, loading the DLL and getting the export, calling through pointer), you can use it like a static library (declare the actual function). The code in the .lib is minimal, it ensures loading the DLL on program startup and forwards the function calls to the DLL implementation.
Peter-HHH (
talk)
00:45, 23 May 2013 (UTC)reply
External References to Microsoft
External References to Microsoft knowledge base in the form of direct links will eventually stop working, because Microsoft frequently rearranges its website in a non-compatible manner. —Preceding
unsigned comment added by
86.82.106.129 (
talk)
13:18, 27 December 2010 (UTC)reply
Using explicit run-time linking ,c(pp) exaple addendum
Suggesting to change the c/cpp example code line from
shows using in that format, by putting the 'WINAPI' in the statement (but not totaly sure what it does yet).
Reason being is that while attempting to learn to use the dll's on dev-c++, I've spent over a day wondering why the static linked function worked, while dynamic linked function crashed the program (after messing the program flow, and partially working). After some time, of looking at another code, it finally worked after adding in the WINAPI word. I'm not sure what other ide's/compilers might require it, but it might be helpful to point it out, to try adding it in into all of the typedef statements. —Preceding
unsigned comment added by
76.190.255.231 (
talk)
04:51, 28 December 2010 (UTC)reply
WINAPI resolves to __stdcall on x86, which declares the calling convention - i.e. how arguments and results are passed, and who cleans up the stack after the call. __stdcall is supported by most client compilers. (The problem you encountered was probably a mismatch of the implementaiton in the DLL and the declaration in the client). I'm not sure how much of this belongs into wikipedia, though.
Peter-HHH (
talk)
00:37, 23 May 2013 (UTC)reply
unverified implication?
the "Background for DLL" seems to imply that Microsoft invented the concept of device drivers. Is that true? can someone support/refute that with references? PratikMallya ☎23:45, 17 April 2011 (UTC)reply
I really don't see any such implication. Perhaps you could suggest a wording that would not imply that to you?
Jeh (
talk)
00:33, 18 April 2011 (UTC)reply
Source annotation is usually not needed if you provide a linker map file to create the library code.
The microsoft dynamic linking system is archaic and most UNIX systems use a more modern system derived from the SunOS dynamic linking system. There are e.g. issues with using data references instead of just functions that may require source annotations when using archaic implementations.
Schily (
talk)
14:44, 19 March 2015 (UTC)reply
"Warning: the following code is vulnerable, it doesn't conform to Microsoft's guidance for safe library loading!"
Several code examples in the article are prefixed with the warning: "Warning: the following code is vulnerable, it doesn't conform to Microsoft's guidance for safe library loading!", probably referring to "
DLL spoofing". Should/could the examples be fixed? –
Tea2min (
talk)
08:27, 22 March 2019 (UTC)reply
A Commons file used on this page or its Wikidata item has been nominated for speedy deletion
The following Wikimedia Commons file used on this page or its Wikidata item has been nominated for speedy deletion: