如何检查 lib 文件?

发布于 2024-10-07 22:46:17 字数 161 浏览 8 评论 0原文

我有一个包含 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

窗影残 2024-10-14 22:46:17

假设您正在询问静态库,Microsoft 图书馆员程序 LIB.EXE 允许您检查库内容。它是 VC++ 发行版的一部分,或者至少以前是——我不再使用 VC++。这些是可用的选项:

Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

usage: LIB [options] [files]

   options:

      /CONVERT
      /DEBUGTYPE:CV
      /DEF[:filename]
      /EXPORT:symbol
      /EXTRACT:membername
      /INCLUDE:symbol
      /LIBPATH:dir
      /LINK50COMPAT
      /LIST[:filename]
      /MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
      /NAME:filename
      /NODEFAULTLIB[:library]
      /NOLOGO
      /OUT:filename
      /REMOVE:membername
      /SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]
      /VERBOSE

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:

Microsoft (R) Library Manager Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

usage: LIB [options] [files]

   options:

      /CONVERT
      /DEBUGTYPE:CV
      /DEF[:filename]
      /EXPORT:symbol
      /EXTRACT:membername
      /INCLUDE:symbol
      /LIBPATH:dir
      /LINK50COMPAT
      /LIST[:filename]
      /MACHINE:{ALPHA|ARM|IX86|MIPS|MIPS16|MIPSR41XX|PPC|SH3|SH4}
      /NAME:filename
      /NODEFAULTLIB[:library]
      /NOLOGO
      /OUT:filename
      /REMOVE:membername
      /SUBSYSTEM:{NATIVE|WINDOWS|CONSOLE|WINDOWSCE|POSIX}[,#[.##]]
      /VERBOSE
美煞众生 2024-10-14 22:46:17

您还可以考虑做另一件事来减少使用静态库导入的内容量。在 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 new name.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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文