Talk:Dynamic-link library

message: 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:
[HKEY_CLASSES_ROOT\CLSID\{00000105-0000-0010-8000-00AA006D2EA4}\InprocServer32]
@="C:\\Program Files\\Common Files\\Microsoft Shared\\DAO\\dao360.dll"
[HKEY_CLASSES_ROOT\CLSID\{00000106-0000-0010-8000-00AA006D2EA4}\InprocServer32]
@="C:\\Program Files\\Common Files\\Microsoft Shared\\DAO\\dao360.dll"
different GUIDs pointing to the same DLL.
--87.196.95.140 11:05, 22 January 2007 (UTC)
thread_title: Comment on GUIDs

message: The article still needs information on at least the following points.
* address space
# this is a technical idea, and should be explained, or carry a link to a descriptive page.  —Preceding unsigned comment added by 212.44.43.10 (talk) 09:17, 25 November 2008 (UTC)
replies: text: Are you sure all this detail belongs here? Most of this is pure MSDN material. Peter-HHH (talk) 23:41, 13 January 2011 (UTC)
thread_title:  TODO 

message: 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)
thread_title:  What is dll and why is it bad for my memory? 

message: 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.—Kbolino 01:55, 15 May 2007 (UTC)
thread_title:  GCC 

message: 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)
thread_title:  Programming examples 

message: 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.
We could extend this article with a "What to do if a DLL is missing" section, though that may be a magnet for more DLL download sites. SteveLoughran (talk) 12:45, 27 June 2008 (UTC)
thread_title:  Linking to DLL Download sites 

message: 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)
replies: text: 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)

text: Well, all the information I know about Symbian DLL can be seen at http://www.newlc.com/Writing-a-DLL.html. I don't know where to find other low-level details such as the file format, for example. Jmpep (talk) 21:20, 14 November 2008 (UTC)
thread_title:  DLLs on Symbian 

message: 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)
thread_title: DLL fanboys

message: Cosmic Engine (talk) 13:38, 20 May 2009 (UTC)
replies: text: Your link isn't pointing to a reliable source.  There might be a reliable source for the statement. Tedickey (talk) 13:43, 20 May 2009 (UTC)
thread_title:  "DLL" is a generic computer science term, Not Microsoft-Specific 

message: The article says:
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
: Well, correct it then. Jeh (talk) 02:33, 11 July 2009 (UTC)
replies: text:  Done. Mitch Ames (talk) 13:38, 11 July 2009 (UTC)
thread_title:  Explicit run-time linking 

message: 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):
typedef struct _IMAGE_DOS_HEADER {
    WORD   e_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'
#define IMAGE_NT_SIGNATURE          0x00004550  // ASCII "PE00"
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)
thread_title:  Magic Number? 

message: Why do you need anything else than .dll file (function name+function code) and .h file (function name) to use dll? I have heard that on linux you only need .so dynamic library and header file. Is this some name mangling issue? Aquickoverview (talk) 04:57, 16 March 2010 (UTC)
replies: text: Some formats don't have a symbol table embedded in the file (to make loading faster). Tedickey (talk) 08:08, 16 March 2010 (UTC)

text: 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)
thread_title: .lib files - why are needed?

message: 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)
thread_title:  External References to Microsoft 

message: Suggesting to change the c/cpp example code line from 
 typedef double (*importFunction)(double, double);
to
 typedef double (WINAPI *importFunction)(double, double);
As a source 'suggestion', the MS example at
 http://msdn.microsoft.com/en-us/library/ms683212
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)
replies: text: 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)
thread_title:  Using explicit run-time linking ,c(pp) exaple addendum 

message: 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)
replies: text: 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)

text: agree - it's a little wordy, but doesn't assert anything about inventing the concept. TEDickey (talk) 00:35, 18 April 2011 (UTC)
thread_title:  unverified implication? 

message: What's it mean, "any data file with the same file format can be […]" — "same file format" as what, itself? --Jerome Potts (talk) 00:02, 31 March 2013 (UTC)
replies: text: Same file format as "regular" DLLs. Jeh (talk) 01:46, 31 March 2013 (UTC)

text: I fixed the wording and found a reference for the CN. How does it look now? Jeh (talk) 05:47, 31 March 2013 (UTC)
replies: text: Thank you. --Jerome Potts (talk) 04:24, 1 April 2013 (UTC)
thread_title:  Unclear sentence in intro 

message: 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)
thread_title:  "Warning: the following code is vulnerable, it doesn't conform to Microsoft's guidance for safe library loading!" 

message: The following Wikimedia Commons file used on this page or its Wikidata item has been nominated for speedy deletion:
* 
You can see the reason for deletion at the file description page linked above. —Community Tech bot (talk) 16:52, 7 September 2022 (UTC)
thread_title:  A Commons file used on this page or its Wikidata item has been nominated for speedy deletion