Dynamic link library is a way to realize the concept of shared function library. The extension is ". dll".
The dynamic link library provides a way for a process to invoke a function that is not part of its executable code.
The executable code for a function is located in a DLL file that contains one or more functions that have been compiled, linked, and stored separately from their processes.
DLLs help to share data and resources, and multiple applications can access a single copy of the DLL in memory at the same time.
using dynamic link libraries makes it easier to apply updates to individual modules , without affecting the program other parts of the.
Development process:
step1: File---> New---> Project---> Class library---> Copy and paste code---> Build---> Build dlltest
<span style= "FONT-SIZE:14PX;" ><strong>using system;using system.collections.generic;using system.text;namespace DllTest {public Class Class1 {public void ShowMessage () { Console.WriteLine ("You have successfully invoked a dynamic connection! "); Console.ReadLine ();}}} </strong></span>
step2: File---> New---> Project--->console application---> Copy and paste code
Right-click reference ---> Add Reference to add the newly generated DllTest.dll
<strong>using system;using system.collections.generic;using system.text;using System.Runtime.InteropServices ; using Dlltest;namespace dllexample{class program{ static void Main (string[] args) { Dlltest.class1 i = new Class1 (); method to invoke the dynamic-link library i.showmessage ();}}} </strong>
- extends the Application the characteristics;
- can use many kinds of Programming Languages to write;
- simplifies the Software management of the project;
- helps save Memory ;
- helps resource Sharing ;
- facilitates localization of applications;
- helps to resolve Platform differences;
- Can be used for a few special purposes. Windows makes certain features available only to DLLs.
C # dynamic Link library