Please explain basic concepts of a DLL file and its registration in Windows
Solution 1:
DLLs are dynamic-link libraries:
Dynamic-link library, or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems. These libraries usually have the file extension DLL, OCX (for libraries containing ActiveX controls), or DRV (for legacy system drivers).
See Dynamic-link library on Wikipedia.
Solution 2:
dll stands for "Dynamic Link Library". As the name implies, it is a collection of functions (libray) that is linked to your program dynamically during runtime (compared to static linking). Generally dll contain only function. "Modern" .NET dll contain normal .NET objects.
Dlls can be registered. This process (e.g. regsvr32 N:\ame.dll) makes this dll known for the operating system. As an alternative, the dll can be placed in the same directory as the executable or in a directory in the Path. A second alternative is to load the dll via Windows API (LoadLibrary()).
The normal procedure is to register the dll during installation or just copy it in the same directory as the executable.
Solution 3:
A dll is a library of functions that can be used by other programs. Not all dll's need to be registered, that applies only to those that expose their fuctionality as COM objects.
Dll's can come from many places; a good number of them make up Windows as such, others come as part of various software that you install. Microsoft Office, for instance, registers dlls that exposes COM interfaces that allows other applications to incorporate functionality from the Office applications.
Solution 4:
A program is a series of instructions. Normally the computer will read and execute instructions one after another in series.
This is great, but most programs will do the same task at various times, or the same task with slight variations at various times. Rather than rewrite the instructions of that task over and over, an option available to programmers is to package those instructions into a subroutine or function.
Then, instead of copying the instructions over and over, you tell the program to call that function and therefore save space. Linking binds this function to all places that call it in the program, when the program is built. The program is also easier to maintain since, if you want to change that task, you can change it one place and not all over the program.
Most programs have functions that are used within that program. They are part of that program, loaded with it, and only accessible to that program.
But what if you have a great function (such as one that takes a date and returns the day of the week) and want to use it in many different programs? Dynamic Link Libraries, or .dll files in Windows, allow this. It's called dynamic linking because the linking occurs at runtime when program is loaded rather than at build-time when it is compiled (in this case it's called static linking).
You can package the function in a specific .dll, and then tell your main program you want to use, or import functions from that .dll.
Now, if you want to update what that function does, or fix bugs, you're in an even better situation since all you have to do is change the functions in one file and every program that uses it will be automatically updated. The disadvantage is now your program depends on another file to work properly. Usually the benefits outweigh the disadvantages for everything except emergency system recovery programs that need to work when you can't load anything from disk and such.