为什么 LIB 文件具有如此两面派的性质? [英] Why are LIB files beasts of such a duplicitous nature?

查看:28
本文介绍了为什么 LIB 文件具有如此两面派的性质?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解 Microsoft Windows 上的此 LIB 文件业务,并且我刚刚发现了一项发现,希望能够消除迄今为止阻碍我清楚了解该问题的困惑.也就是说,LIB 文件并不是它们的文件扩展名所暗示的那种文件.

I'm trying to understand this LIB file business on Microsoft Windows, and I've just made a discovery that will - I hope - dispel the confusion that hitherto has prevented me from getting a clear grasp of the issue. To wit, LIB files are not the one kind of file that their file extension suggests they are.

:: cd "C:Program Files (x86)Microsoft SDKsWindowsv7.0ALib"

:: lib /nologo /list Ad1.Lib
obji386activdbgid.obj
obji386activscpid.obj
obji386ad1exid.obj
obji386dbgpropid.obj
obji386dispexid.obj

:: lib /nologo /list oledb.lib
o:winmain.obj.x86freenduser…oledbuuidobjfrei386oledbiid.obj
o:winmain.obj.x86freenduser…oledbuuidobjfrei386oledbnewiid.obj
o:winmain.obj.x86freenduser…oledbuuidobjfrei386cmdtreeiid.obj
o:winmain.obj.x86freenduser…oledbuuidobjfrei386oledbdepiid.obj

:: lib /nologo /list AdvAPI32.Lib | sort | uniq -c
    731 ADVAPI32.dll

前两个示例包含目标文件(当由 lib.exe 实用程序显示时,显示为相对或绝对路径).但是,第三个示例仅包含对 DLL 的 731 个引用.(我猜 lib.exe 不是为了显示此类文件的更多有用信息.)

The first two examples contain object files (appearing as relative or absolute paths when displayed by the lib.exe utility). The third example, however, only contains 731 references to a DLL. (I guess lib.exe isn't designed to display more useful information for this kind of file.)

有些包含目标文件,它们是静态库.其他包含符号,它们是导入库.(此处有简短说明.)

Some contain object files, and they are static libraries. Others contain symbols, and they are import libraries. (There's a short explanation here.)

因此,静态库在 Linux 上似乎是 .a 文件的等价物,而 DLL 在 Linux 上似乎映射到 .so 文件.(顺便说一句,导入库如何适应这个 Windows/Linux 等效图?)

So static libraries appear to be the equivalents of .a files on Linux, and DLLs appear to map to .so files on Linux. (By the way, how would import libraries fit into this Windows/Linux equivalence picture?)

现在我想知道为什么会这样?为什么 Microsoft 决定为导入库提供与静态库相同的文件扩展名?(我知道从历史上看,静态库是第一位的,就像生命的原始形式先于更复杂的形式一样.)他们为什么不说,好吧,这是这些新类型的库,它们应该被称为导入库,它们应该承担文件扩展名.ILB(或其他)?

Now I'm wondering why this is so? Why did Microsoft decide to give import libraries the same file extension as static libraries? (I understand that historically, static libraries were first, like primitive forms of life preceded more complex forms.) Why wouldn't they say, okay, here's these new kind of libraries, they shall be referred to as import libraries, and they shall bear the file extension .ILB (or whatever)?

推荐答案

因为它们库.为什么要为与供应商特定的库完全相同的东西发明一个全新的特定于供应商的扩展?

Because they are libraries. Why invent a whole new vendor-specific extension for what is exactly the same thing as their already-vendor-specific libraries?

这篇关于为什么 LIB 文件具有如此两面派的性质?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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