DEV Community

Nicholas Fazzolari
Nicholas Fazzolari

Posted on

What are Some Common Use Cases for DLL's in Windows Applications

I understand the core principle of what a DLL (Dynamic Linking Library) is, and can even implement a very basic one to use with my program. However, I'm curious to understand the rationale of them being implemented from a software engineering perspective. Are there common use cases that could help me understand their purpose better?

I notice many programs use them, yet in tutorials and even my coursework so far, DLL's never come up.

Top comments (5)

Collapse
 
dmfay profile image
Dian Fay

Encapsulation and reusability. If you write some generally useful functionality (an XML parser, a communications layer, a device driver) it only does you so much good if it's bolted into a single application. Better to factor it out into a library you can drop in and invoke from anywhere, and it's easier to maintain and test independently too.

Collapse
 
nickfazzpdx profile image
Nicholas Fazzolari

Thanks for the response.

Collapse
 
jfrankcarr profile image
Frank Carr

Here's an example I worked on in my current sprint. The user story was to create an encryption/decryption component to encode and decode data strings for certain devices. It needed to be callable from SSIS scripts, C# desktop manufacturing floor apps and by web apps via a web service. This same DLL can be used in all these locations and in any new applications that require this functionality. This means that code won't be duplicated in several places by different programmers.

I've created a lot of other such components over the years for things like database access, device control and many other things. The basic idea is to build a library of functions, you might call it an API, that are commonly used across several applications, either current ones or planned new development.

Increasingly, DLLs are being replaced by web services although the basic strategy of not duplicating functionality and code across many apps is still in place.

Collapse
 
nickfazzpdx profile image
Nicholas Fazzolari

Thank you for the response. It makes sense that web services are gaining traction with more apps being distributed and accessed over the web.

Collapse
 
alanmbarr profile image
Alan Barr

Plugins and modules that can be added to a program by placing it in a common folder or structure. It comes in handy especially if you have a team or teams of people working at different cadences. There's more flexibility in iterating if you're not bound by the cadence of the main project vs a self-contained module.