52ky 发表于 2022-9-22 14:55:42

动态链接库

来历版块:C/C++
压缩包内文件格式:文本内容
附件来历:互联网
运行方式:Windows方式
是不是经自己验证:是
附件性质:免费
具体说明:自从Microsoft企业推出第一个版本的Windows操作系统以来,动态链接库(DLL)一直是这个操作系统的基础。WindowsAPI中的一切函数都包括在DLL中。3个最主要的DLL是Kernel32.dll,它包括用于管理内存、进程和线程的各个函数;User32.dll,它包括用于履行用户界面命令(如窗口的创建和消息的传送)的各个函数;GDI32.dll,它包括用于画图和显示文本的各个函数。Windows还配有若干别的DLL,它们提供了用于履行一些特别命令的函数。例如,AdvAPI32.dll包括用于实现目标安全性、注册表操作和事件记录的函数;ComDlg32.dll包括常用对话框(如FileOpen和FileSave);ComCtl32.dll则支持一切的常用窗口控件。
本章将要介绍如何为使用程序创建DLL。下面是为何要使用DLL的一些因素:
1、它们扩展了使用程序的特性。由于DLL可以动态地装入进程的地址空间,因而使用程序可以在运行时断定需求履行啥操作,然后装入相应的代码,以便基于需求履行这些操作。例如,当一家企业开发了一种产品,想要让别的企业改善或增强该产品的功能时,那么就可以使用DLL。
2、它们可以用很多种编程言语来编写。可以选择手头具有的最好的言语来编写DLL。或许你的使用程序的用户界面使用MicrosoftVisualBasic编写得最好,可是用C++来管理它的商用逻辑更好。系统许可VisualBasic程序加载C++DLL、CobolDLL和FortranDLL等。
3、它们简化了软件项意图管理。假如在软件开发过程中不相同的工作小组在不相同的模块上工作,那么这个项目管理起来比较容易。可是,使用程序在出售时顺便的文件应该尽量少一些。我认识有一家企业出售的产品顺便了100个DLL——每个程序员最多有5个DLL。这样,使用程序的初始化时刻将会长得吓人,由于系统有必要打开100个磁盘文件以后,程序才干履行它的操作。
4、它们有助于节约内存。假如两个或多个使用程序使用同一个DLL,那么该DLL的页面只需放入RAM一次,一切的使用程序都可以共享它的各个页面。C/C++运行期库即是个很好的比如。很多使用程序都使用这个库。假如一切的使用程序都链接到这个静态库,那么sprintf、strcpy和malloc等函数的代码就要屡次存在于内存中。可是,假如一切这些使用程序链接到DLLC/C++运行期库,那么这些函数的代码就只需求放入内存一次,这意味着内存的使用将愈加有效。
5、它们有助于资源的共享。DLL可以包括对话框模板、字符串、图标和位图等资源。多个使用程序可以使用DLL来共享这些资源。
6、它们有助于使用程序的本地化。使用程序常常使用DLL对自己进行本地化。例如,只包括代码而不包括用户界面组件的使用程序可以加载包括本地化用户界面组件的DLL。
7、它们有助于管理方式区别。不相同版本的Windows配有不相同的函数。开发人员常常想要调用新的函数(假如它们存在于主机的Windows版本上的话)。可是,假如你的源代码包括了对一个新函数的调用,而你的使用程序将要在不能提供该函数的Windows版本上运行,那么操作系统的加载程序将回绝运行你的进程。即便你实际上从不调用该函数,状况也是这样。假如将这些新函数保存在DLL中,那么使用程序就可以将它们加载到Windows的老版本上。当然,你仍然可以成功地调用该函数。
8、它们可以用于一些特别的意图。Windows使得某些特性只能为DLL所用。例如,只有当DLL中包括某个挂钩通知函数的时候,才干安装某些挂钩(使用SetWindowsHookEx和SetWinEventHook来进行安装)。可以通过创建有必要在DLL中生计的COM目标来扩展WindowsExplorer的外壳程序。用于可以由Web浏览器加载的、用于创建内容丰富的Web页的ActiveX控件来说,状况也是相同
动态链接库.chm
.....太多文件了略.....

(Origin section: C/C
Compressed file format: text content
Attachment source: Internet
Operation mode: Windows mode
Is it verified by yourself: yes
Attachment nature: free
Specifics: Since the introduction of the first version of the Windows operating system by Microsoft Enterprise, dynamic link libraries (DLLs) have been the foundation of the operating system. All functions in WindowsAPI are included in DLL. The three main DLLs are Kernel32.dll, which includes functions for managing memory, processes, and threads; User32.dll, which includes functions for performing user interface commands such as window creation and message delivery ; GDI32.dll, which includes functions for drawing and displaying text. Windows also comes with several other DLLs that provide functions for performing some special commands. For example, AdvAPI32.dll includes functions for implementing target security, registry operations and event logging; ComDlg32.dll includes common dialog boxes (such as FileOpen and FileSave); ComCtl32.dll supports all common window controls.
This chapter will describe how to create DLLs for use by programs. Here are some factors why you should use a DLL:
1. They extend the features of the user program. Because DLLs can be dynamically loaded into the address space of a process, the user program can determine at runtime what operations are required to perform, and then load the appropriate code to perform these operations based on requirements. For example, a DLL is used when a company develops a product that other companies want to improve or enhance.
2. They can be written in many programming languages. The DLL can be written in the best language you have at hand. Perhaps your application's user interface is best written in Microsoft Visual Basic, but it's better to use C   to manage its business logic. The system permits VisualBasic programs to load CDLL, CobolDLL and FortranDLL, etc.
3. They simplify software project intent management. The project is easier to manage if different working groups work on different modules in the software development process. However, the documentation that comes with the program when it is sold should be as few as possible. I know a business that sells a product with 100 DLLs by the way - up to 5 DLLs per programmer. In this way, the initialization time of the application program will be terrifyingly long, because the system must open 100 disk files before the program can perform its operations.
4. They help save memory. If two or more applications use the same DLL, the pages of the DLL only need to be put into RAM once, and all applications can share its pages. The C/C   runtime library is a good example. Many applications use this library. If all application programs are linked to this static library, then the code for functions such as sprintf, strcpy, and malloc will repeatedly exist in memory. However, if all these applications are linked to the DLLC/C   runtime library, then the code for these functions only needs to be put into memory once, which means that memory usage will be more efficient.
5. They contribute to the sharing of resources. DLLs can include resources such as dialog templates, strings, icons, and bitmaps. Multiple consumers can use the DLL to share these resources.
6. They help the localization of using programs. User programs often use DLLs to localize themselves. For example, a consumer program that includes only code and no user interface components can load a DLL that includes localized user interface components.
7. They help to differentiate management styles. Different versions of Windows have different functions. Developers often want to call new functions (if they exist on the host's Windows version). However, if your source code includes a call to a new function, and your application is going to run on a version of Windows that doesn't provide that function, the operating system's loader will refuse to run your process. This is the case even if you never actually call the function. If these new functions are stored in a DLL, the user program can load them on older versions of Windows. Of course, you can still call the function successfully.
8. They can be used for some special purpose. Windows makes certain features available only to DLLs. For example, certain hooks (using SetWindowsHookEx and SetWinEventHook to install) can only be installed when a certain hook notification function is included in the DLL. Windows Explorer's shell can be extended by creating COM objects that must live in DLLs. The same is true for ActiveX controls that can be loaded by a web browser and used to create rich web pages
dynamic link library.chm
.....too many files .....)




页: [1]
查看完整版本: 动态链接库