C++ .dll、.lib、.h 文件之间有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1778111/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 21:08:56  来源:igfitidea点击:

What's the differences between .dll , .lib, .h files?

c++windowsdllheader-files

提问by MemoryLeak

Why in a project should I include some *.lib, .h or some other files? And what are these things used for?

为什么我应该在项目中包含一些 *.lib、.h 或一些其他文件?而这些东西是干什么用的?

回答by siukurnin

  • .h: header file, its a source file containing declarations (as opposed to .cpp, .cxx, etc. containing implementations),

  • .lib: static library may contain code or just links to a dynamic library. Either way it's compiled code that you link with your program. The static library is included in your .exe at link time.

  • .dll: dynamic library. Just like a static one but you need to deploy it with your .exe file because it's loaded at run time.

  • .h: 头文件,它是一个包含声明的源文件(与包含实现的 .cpp、.cxx 等相反),

  • .lib: 静态库可能包含代码或只是指向动态库的链接。无论哪种方式,它都是与程序链接的编译代码。静态库在链接时包含在您的 .exe 中。

  • .dll: 动态库。就像静态文件一样,但您需要使用 .exe 文件部署它,因为它是在运行时加载的。

回答by Frank Krueger

  • HDeclares the interface to a library - including functions, structures, and constants. Written in the C language.
  • LIBEither declares the binary interface to a dynamic library (DLL) orcontains the binary code of a library.
  • DLLA dynamic library - your application shares these with the system or you use them to keep your code base organized.
  • DEFA textual description of functions exported by a DLL.
  • H声明库的接口 - 包括函数、结构和常量。用C语言编写。
  • LIB声明动态库 (DLL) 的二进制接口包含库的二进制代码。
  • DLL动态库 - 您的应用程序与系统共享这些库,或者您使用它们来保持代码库的组织性。
  • DEF由 DLL 导出的函数的文本描述。

回答by john david

*.dlb is similar to static library.

*.dlb 类似于静态库。