Visual Studio:什么是lib文件(用于)? [英] Visual Studio: What exactly are lib files (used for)?

查看:84
本文介绍了Visual Studio:什么是lib文件(用于)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习C ++,遇到那些明显被链接器使用的* .lib文件。

I'm learning C++ and came across those *.lib files that are obviously used by the linker. I had to set some additional dependencies for OpenGL.


  • 这个上下文中的库文件究竟是什么?

  • 他们的内容是什么?

  • 如何生成它们?

  • 还有什么值得了解的吗?

  • What exactly are library files in this context used for?
  • What are their contents?
  • How are they generated?
  • Is there anything else worth knowing about them?

还是他们只是类似于* .obj文件的可重定位对象代码?

Or are they just nothing more than relocateable object code similiar to *.obj files?

推荐答案

简单来说,是的 - .lib文件只是一个.obj文件的集合。

In simple terms, yes - .lib files are just a collection of .obj files.

在Windows上有一个小小的复杂性,你可以有两个类的lib文件。

静态lib文件本质上包含一个.obj和与您的程序链接,以提供.lib中的所有功能。它们主要是为了节省你有很多文件来处理方便。

There is a slight complication on Windows that you can have two classes of lib files.
Static lib files essentially contain a collection of .obj and are linked with your program to provide all the functions inside the .lib. They are mainly a convenience to save you having as many files to deal with.

还有stub .lib,它们只提供了a中包含的函数的定义。 dll文件。
在编译时使用.lib文件来告诉编译器从函数中期望什么,但是在运行时从dll加载代码。

There are also stub .lib which provide just the definitions of functions which are contained in a .dll file. The .lib file is used at compile time to tell the compiler what to expect from the function, but the code is loaded at run time from the dll.

这篇关于Visual Studio:什么是lib文件(用于)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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