如何检查 lib 文件?
我有一个包含 390 个库的列表,需要将软件从实验室 CVI 移植到 Visual C。这些依赖关系快要了我的命。
我无法导入所有这些,这太过分了 - 而且并非所有它们都是唯一的和/或根本可以加载。
有没有一种简单的方法来确定 lib 文件进行哪些调用? 有这方面的编辑吗?
I have a List of 390 Libraries and need to port a software from lab CVI to Visual C. Those dependencies are killing me.
I cant import all of them, that would be overkill - and not all of them are unique and/or can be loaded at all.
Is there an easy way to determine what calls a lib file takes?
Are there any editors for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您正在询问静态库,Microsoft 图书馆员程序 LIB.EXE 允许您检查库内容。它是 VC++ 发行版的一部分,或者至少以前是——我不再使用 VC++。这些是可用的选项:
The Microsoft librarian program LIB.EXE allows you to examine library contents, assuming you are asking about static libraries. It's part of the VC++ distribution, or at least it used to be - I don't use VC++ any more. These are the options available:
您还可以考虑做另一件事来减少使用静态库导入的内容量。在 CVI 中,打开与您正在使用的 .lib/.dll 对应的头文件。将此文件保存到不同的
name.h
。再次在编辑器中编辑该文件以仅包含您想要使用的导出函数。 警告: 不要编辑掉您想要保留的函数可能调用的函数。一旦您确信您拥有代表您想要的内容的文件,请单击新文件中的任意位置
name.h
文件(以确保它是活动文件)并使用工作区顶部的菜单选择选项->生成 DLL 导入库...将出现一个弹出文件选择对话框。使用该对话框,导航到与要生成的
.lib
文件相对应的.dll
。如果成功,将创建一个新的name.lib
,仅包含您想要的导出函数。限制导出数量的另一个好处是,它将有助于避免COFF混合在不同环境中创建的库时有时会出现不兼容问题。
There is one other thing you might consider doing to reduce the amount of content that you import with a static library. In CVI, open the header file corresponding to the .lib/.dll that you are using. Save this file to a different
name.h
.Again, in the editor, edit that file to include only the exported functions you would like to use. Caution: Do not edit out functions that may be called by the functions you intend to keep. Once satisfied you have a file representative of what you want, click anywhere in the new
name.h
file (to make sure it is the active file) and use the menus at the top of the workspace to select Options->Generate DLL Import Library...A popup file selection dialog box will appear. Using that dialog, navigate to the
.dll
corresponding to the.lib
file you want to generate. If successful, a newname.lib
will be created containing only the exported functions you want.One additional side benefit of limiting the number of exports is that it will help to avoid COFF incompatibility problems sometimes seen when mixing libraries created in different environments.