如何将.lib导入.dll? [英] How to import .lib into .dll?
问题描述
我正在尝试将dll编码为某些使用C ++的系统的插件.该插件将使用另一个库,该库是一个.lib文件,因此应仅输出一个.dll文件.因此,我希望这个其他.lib文件包含在我的dll中.应该只包含一个dll文件,并且应该包含lib文件,这样我就可以将该dll文件作为一个文件插件包含到系统中.这有可能吗?
I'm trying to code a dll as a plugin for some system using C++. This plugin will make use of another library which is a .lib file and should output only one .dll file as a result. So I want this other .lib file included in my dll. There should be only one dll file and lib file should be included in it, so that I could include this dll file into the system as a one-file plugin. Is this possible and how?
我正在使用Visual C ++ 2010 Express.
I'm using Visual C++ 2010 Express.
谢谢.
推荐答案
Unfortunately, the VS linker doesn't have an option equivalent to ld
's --whole-archive
which can be used to include an entire library.
您最好的选择是解压缩库并链接到生成的目标文件中.您可以为此使用图书管理员( lib
工具).要列出该库的所有成员,请使用 lib/LIST
.必须使用来逐个提取目标文件. lib/EXTRACT:member
.
Your best bet is to unpack the library and link in the resulting object files. You can use the librarian (lib
tool) for that. To list all members of the library, use lib /LIST
. Object files have to be extracted one by one, using lib /EXTRACT:member
.
这篇关于如何将.lib导入.dll?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!