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

      <tfoot id='vEJG5'></tfoot>
        <bdo id='vEJG5'></bdo><ul id='vEJG5'></ul>
    2. <small id='vEJG5'></small><noframes id='vEJG5'>

    3. 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?

      What is inside .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?(静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?)
    4. <legend id='G05Cw'><style id='G05Cw'><dir id='G05Cw'><q id='G05Cw'></q></dir></style></legend>
          <i id='G05Cw'><tr id='G05Cw'><dt id='G05Cw'><q id='G05Cw'><span id='G05Cw'><b id='G05Cw'><form id='G05Cw'><ins id='G05Cw'></ins><ul id='G05Cw'></ul><sub id='G05Cw'></sub></form><legend id='G05Cw'></legend><bdo id='G05Cw'><pre id='G05Cw'><center id='G05Cw'></center></pre></bdo></b><th id='G05Cw'></th></span></q></dt></tr></i><div id='G05Cw'><tfoot id='G05Cw'></tfoot><dl id='G05Cw'><fieldset id='G05Cw'></fieldset></dl></div>
        • <small id='G05Cw'></small><noframes id='G05Cw'>

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

                  <tbody id='G05Cw'></tbody>
                <tfoot id='G05Cw'></tfoot>
              • 本文介绍了静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                静态库、静态链接动态库和动态链接动态库的.lib文件里面是什么?

                What is inside of a .lib file of Static library, Statically linked dynamic library and dynamically linked dynamic library?

                为什么动态链接的动态库和静态链接中不需要 .lib 文件,.lib 文件只是一个包含所有方法的 .obj 文件.对吗?

                How come there is no need for a .lib file in dynamically linked dynamic library and also that in static linking, the .lib file is nothing but a .obj file with all the methods. Is that correct?

                推荐答案

                对于静态库,.lib 文件包含该库的所有代码和数据.然后链接器识别它需要的位并将它们放入最终的可执行文件中.

                For a static library, the .lib file contains all the code and data for the library. The linker then identifies the bits it needs and puts them in the final executable.

                对于动态库,.lib 文件包含从库中导出的函数和数据元素的列表,以及它们来自哪个 DLL 的信息.当链接器构建最终的可执行文件时,如果使用了库中的任何函数或数据元素,则链接器会添加对 DLL 的引用(使其由 Windows 自动加载),并将条目添加到可执行文件的导入表中,以便对该函数的调用被重定向到该 DLL 中.

                For a dynamic library, the .lib file contains a list of the exported functions and data elements from the library, and information about which DLL they came from. When the linker builds the final executable then if any of the functions or data elements from the library are used then the linker adds a reference to the DLL (causing it to be automatically loaded by Windows), and adds entries to the executable's import table so that a call to the function is redirected into that DLL.

                您不需要 .lib 文件即可使用动态库,但如果没有,您就无法将 DLL 中的函数视为代码中的普通函数.相反,您必须手动调用 LoadLibrary 来加载 DLL(完成后调用 FreeLibrary),并调用 GetProcAddress 来获取函数的地址或 DLL 中的数据项.然后,您必须将返回的地址转换为适当的函数指针才能使用它.

                You don't need a .lib file to use a dynamic library, but without one you cannot treat functions from the DLL as normal functions in your code. Instead you must manually call LoadLibrary to load the DLL (and FreeLibrary when you're done), and GetProcAddress to obtain the address of the function or data item in the DLL. You must then cast the returned address to an appropriate pointer-to-function in order to use it.

                这篇关于静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                How do I load a C DLL from the SXS in Python?(如何从 Python 中的 SXS 加载 C DLL?)
                Can Cython code be compiled to a dll so C++ application can call it?(Cython 代码可以编译成 dll 以便 C++ 应用程序可以调用它吗?)
                Delay Loading DLLs(延迟加载 DLL)
                Throwing C++ exceptions across DLL boundaries(跨 DLL 边界抛出 C++ 异常)
                Loading a dll from a dll?(从 dll 加载 dll?)
                C++11 std::mutex in Visual Studio 2012 deadlock when locked from DllMain()(当从 DllMain() 锁定时,Visual Studio 2012 中的 C++11 std::mutex 会死锁)

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

                        <tbody id='d8zFD'></tbody>
                        • <small id='d8zFD'></small><noframes id='d8zFD'>

                          <legend id='d8zFD'><style id='d8zFD'><dir id='d8zFD'><q id='d8zFD'></q></dir></style></legend>
                          <tfoot id='d8zFD'></tfoot>