Dynamic Link Libraries Inside-Out
(Page 1 of 9 )
This article covers the advantages and disadvantages of Dynamic Link Libraries, how to write them, a discussion of the Entry point function, types of DLL linkage and more.
Support Files for this article are available at the end of this article.
Overview
Reusing code has been an area of interest for researchers and developers equally. With each new emerging technology we get to see a new form of it in action. Let it be COM (the binary standard) or the new buzzword .NET, all are equipped to provide code reusability to today’s developer.
In this article we’re going to talk about DLLs or the Dynamic Link Libraries. The areas that’ll be highlighted include the advantages/disadvantages, writing DLLs, a discussion of the Entry point function, types of DLL linkage and more. We’ll also discuss the common pitfalls and mistakes made by developers and common troubleshooting issues. I’ve also included a PowerPoint presentation which gives a brief overview of this article that you may find useful.
I won’t assume that you’ve ever written or used DLLs, but I do assume that you know basic Win32 application programming using the C/SDK and understand how to use the Visual Studio IDE. It’d be a plus if you’re familiar with basic operating system concepts like processes threads and fibers because you’ll get a better understanding of the concept being explained. But be sure that at the end of this article you’ll be able to harness the power offered by DLLs in the next project you design.
Introduction
As the name ‘Dynamic Link Library’ implies DLLs are libraries that contain code and data that can be used across multiple applications at the same time. For example the USER32.dll or the KERNEL32.dll are the DLLs that every windows program needs in order to work on the Win32 Subsystem.
Once written and packed in a DLL, a function can be used in any application in its binary form without actually referring to its source code. Same is the case with data (if you choose to!). But you may ask, “I can do so by just including the source files and using the function in my application.” Yes, indeed, this was the way programs were written in the DOS days, but the enhancements made to the underlying hardware when reflected by the operating system sitting at the top of it are magnified manifolds and one should be able to leverage it to reap maximum benefits. Moreover there might be situations where you don’t have the source code and you know a third-party DLL can be used. Talking of benefits, we shall just glance through the advantages and disadvantages of using DLLs.
Next: Advantages and Disadvantages of Using DLLs >>
More Code Examples Articles
More By Digvijay Chauhan