C # dynamic Link library

Source: Internet
Author: User
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 a dynamic-link library makes it easier to apply updates to individual modules without affecting other parts of the program.

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>

The above is the content of C # dynamic link library, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.