什么是使用.EXP的,是什么样的.lib和.dll的区别 [英] what is use of .exp and what is the difference between .lib and .dll

查看:106
本文介绍了什么是使用.EXP的,是什么样的.lib和.dll的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编译和链接,有什么用.EXP的?是什么的.lib和.dll之间的区别?我知道的.lib将被使用,而连接并运行程序时的.dll将被使用。但究竟什么是的.lib和.dll区别?

During compilation and linking, what is use of .exp? What is the difference between .lib and .dll? I know that .lib will be used, while linking and .dll will be used when running the program. But what exactly is the difference between .lib and .dll?

难道.LIB文件不包含code从.dll文件来的功能呢?
什么是需要使用两个单独的文件?

Does .lib file not contain the code for the functions coming from .dll files? What is the need for using two separate files?

请澄清。在此先感谢

推荐答案

在导入库一个DLL的情况下,.LIB文件执行的的包含任何实际的code。在所有。它基本上只包含在相关联的DLL函数列表 - 足够的链接嵌入到该DLL的引用到的东西与图书馆联系,但仅此而已。

In the case of an import library for a DLL, the .lib file does not contain any actual code at all. It basically contains just a list of the functions in the associated DLL -- enough for the linker to embed a reference to that DLL into something linked with the library, but not much else.

一个.EXP文件是一个导出文件 - 基本上差不多一样的的.lib文件。它的使用(至少主要)当你有一个循环依赖。例如,假设您有作为一个插件可执行文件的DLL。可执行通过DLL插件提供使用部分出口的功能,还需要能够调用插件的一些功能,以及(例如装载并初始化一个插件)。

A .exp file is an export file -- basically just about the same as a .lib file. It's used (at least primarily) when you have a circular dependency. For example, assume you have a DLL that acts as a plug-in for an executable. The executable supplies some exported functions for use by plug-in DLLs, but also needs to be able to call some functions in the plug-ins as well (e.g. to load and initialize a plug-in).

该DLL不能链接到可执行文件是建立在提供的.lib文件 - 但是可执​​行文件将无法链接,直到DLL是建立在提供的.lib文件。为了打破依赖,运行对可执行文件,它失败(因为它无法找到该DLL中的.lib文件)的链接,但是的将会的产生.EXP文件。然后,对可执行的文件.exp链接DLL。然后,您可以重新运行链接,生成可执行,使用的.lib文件的DLL。

The DLL won't link until the executable is built to provide a .lib file -- but the executable won't link until the DLL is built to provide a .lib file. To break the dependency, you run the linker against the executable, which fails (because it can't find a .lib file for the DLL), but will produce a .exp file. You then link the DLL against the .exp file for the executable. You can then re-run link to produce the executable, using the .lib file for the DLL.

这篇关于什么是使用.EXP的,是什么样的.lib和.dll的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆