Programming technology and application of DLL in Windows

Source: Internet
Author: User
Tags new features

Absrtact: This paper introduces the basic application methods and applications of DLL technology in Windows programming, and gives all the source code of two practical DLLs of direct memory access and port I/O.

Keywords: DLL Windows programming Memory access I/O

First, the introduction

Because Windows provides an unprecedented standard user interface, graphics processing power, and simple agile operation for microcomputers, most programmers have turned or are turning to Windows programming. In the programming tasks of many user-designed practical application systems, it is often needed to realize software's access to hardware resources and memory resources, such as Port I/O, DMA, interrupts, direct memory access, and so on. It would be easy to prepare a DOS program, but it would be more difficult to compile Windows programs, especially in windowsnt environments.

Because Windows has "device-independent" features, does not advocate with the bottom of the machine to deal with things, if the direct use of Windows API functions or I/O read and write instructions to access and operation, the program will often run a protection mode error or even panic, more serious situation will lead to system crashes. So how to solve these problems conveniently under Windows? Using DLL (Dynamic Link libraries) technology is one of the good ways.

DLLs are the most important component of Windows, and many of the new features and new features in Windows are implemented through DLLs, so it is important to master it and apply it. In fact, Windows itself is composed of many DLLs, its most basic three major components kernel, GDI and user are DLLs, all of its library modules are also designed as DLLs. In general. Dll. DRV,. FON,. SYS and many of the system files with the. exe extension are DLLs, and if you open the Windows\System directory, you can see many DLL modules. Although DLLs run under Ring3 priority, they are a convenient way to implement hardware interfaces. DLLs can have their own data segments, but without its own stack, using the same stack pattern as the application that invoked it, reduces programming inconvenience; At the same time, a DLL has only one instance in memory so that it can use memory efficiently and cost-effectively; The Code encapsulation of DLL implementation makes the program concise and clear. In addition, there is one of the most important features, that is, the compilation of DLLs and the specific programming language and compiler independent, as long as the implementation of the DLL's development specifications and programming policies, and to arrange the correct call interface, regardless of the programming language of the DLL is universal. For example, in the BC31 of the DLL program, can be used in BC, VC, VB, Delphi and other language environment. Under the BC31 environment, the author compiles the direct memory access and port I/O two DLLs in Windows, and uses it in multiple-self system applications.

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.