<i id='QoJfC'><tr id='QoJfC'><dt id='QoJfC'><q id='QoJfC'><span id='QoJfC'><b id='QoJfC'><form id='QoJfC'><ins id='QoJfC'></ins><ul id='QoJfC'></ul><sub id='QoJfC'></sub></form><legend id='QoJfC'></legend><bdo id='QoJfC'><pre id='QoJfC'><center id='QoJfC'></center></pre></bdo></b><th id='QoJfC'></th></span></q></dt></tr></i><div id='QoJfC'><tfoot id='QoJfC'></tfoot><dl id='QoJfC'><fieldset id='QoJfC'></fieldset></dl></div>

    <bdo id='QoJfC'></bdo><ul id='QoJfC'></ul>

<legend id='QoJfC'><style id='QoJfC'><dir id='QoJfC'><q id='QoJfC'></q></dir></style></legend>

<small id='QoJfC'></small><noframes id='QoJfC'>

  • <tfoot id='QoJfC'></tfoot>

      1. .dll 文件是为每个程序加载一次还是为所有程序加载一次?

        时间:2023-08-28

        <legend id='Hn9mD'><style id='Hn9mD'><dir id='Hn9mD'><q id='Hn9mD'></q></dir></style></legend>
          <tfoot id='Hn9mD'></tfoot>
            <tbody id='Hn9mD'></tbody>
            1. <i id='Hn9mD'><tr id='Hn9mD'><dt id='Hn9mD'><q id='Hn9mD'><span id='Hn9mD'><b id='Hn9mD'><form id='Hn9mD'><ins id='Hn9mD'></ins><ul id='Hn9mD'></ul><sub id='Hn9mD'></sub></form><legend id='Hn9mD'></legend><bdo id='Hn9mD'><pre id='Hn9mD'><center id='Hn9mD'></center></pre></bdo></b><th id='Hn9mD'></th></span></q></dt></tr></i><div id='Hn9mD'><tfoot id='Hn9mD'></tfoot><dl id='Hn9mD'><fieldset id='Hn9mD'></fieldset></dl></div>

              <small id='Hn9mD'></small><noframes id='Hn9mD'>

                <bdo id='Hn9mD'></bdo><ul id='Hn9mD'></ul>

                  本文介绍了.dll 文件是为每个程序加载一次还是为所有程序加载一次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个简单的小问题,知道的人可以轻松回答,我用谷歌搜索但找不到答案.

                  I have a simple small question which someone who knows will be able to answer easily, I searched google but couldn't find the answer.

                  计算机上同时运行着许多程序,我的问题是:当一个程序加载一个 DLL 时,它是实际加载了 DLL 文件还是找到了已加载 DLL 的内存?例如,ws2_32.dll (winsock 2) 是为每个使用winsock 的程序加载,还是加载一次并且所有使用它的程序都使用相同的内存地址来调用函数?

                  There are many programs running at once on a computer, and my question is: when a program loads a DLL, does it actually load the DLL file or does it find the memory in which the DLL is already loaded? For example, is ws2_32.dll (winsock 2) loaded for every program that uses winsock, or is it loaded once and all programs that use it use the same memory addresses to call the functions?

                  推荐答案

                  它加载一次,所有程序共享相同的内存中代码副本.这有点复杂,但对于 DLL 的只读部分(即代码),操作系统加载程序使用一种称为内存映射"的技术将 DLL 映射到进程的地址空间.这些页面只被所有进程加载到物理内存中一次,即使它们可能将页面映射到其虚拟地址空间中的不同地址.

                  It's loaded once and all programs share the same in-memory copy of code. It's kind of complicated, but for the read-only sections of the DLL (that is, code) the operating system loader uses a technique called "memory mapping" to map the DLL into the process's address space. The pages are only loaded into physical memory once for all processes, even though they may have the page mapped to different address in their virtual address space.

                  但是,每个进程都有一个单独的数据部分(因此全局变量不会共享 - 除非您明确要求它们)并且它们显然也有一个单独的堆,因此不会共享动态分配的内存.

                  However, each process has a separate data section (so that global variables are not shared - unless you explicitly ask them to be) and they obviously also have a separate heap so that dynamically-allocated memory is not shared.

                  这篇关于.dll 文件是为每个程序加载一次还是为所有程序加载一次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何静态链接 .DLL? 下一篇:在没有标题的c ++ dll中调用函数

                  相关文章

                  <i id='OBzDW'><tr id='OBzDW'><dt id='OBzDW'><q id='OBzDW'><span id='OBzDW'><b id='OBzDW'><form id='OBzDW'><ins id='OBzDW'></ins><ul id='OBzDW'></ul><sub id='OBzDW'></sub></form><legend id='OBzDW'></legend><bdo id='OBzDW'><pre id='OBzDW'><center id='OBzDW'></center></pre></bdo></b><th id='OBzDW'></th></span></q></dt></tr></i><div id='OBzDW'><tfoot id='OBzDW'></tfoot><dl id='OBzDW'><fieldset id='OBzDW'></fieldset></dl></div>

                  <small id='OBzDW'></small><noframes id='OBzDW'>

                    <tfoot id='OBzDW'></tfoot>

                    1. <legend id='OBzDW'><style id='OBzDW'><dir id='OBzDW'><q id='OBzDW'></q></dir></style></legend>

                      • <bdo id='OBzDW'></bdo><ul id='OBzDW'></ul>