头文件,DLL和库之间的关系/区别是什么? [英] What is the relation/difference between a header file, dll and library?

查看:88
本文介绍了头文件,DLL和库之间的关系/区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

头文件,dll和库之间的关系/区别是什么?

解决方案

头文件包含某些内容的声明(常量,类,... ),通常以.h或hpp扩展名结尾。


DLL(动态链接库)是一个二进制文件(带.dll,.ocx,.a,...扩展名) ),包含函数,资源......并且可以在运行时链接到您的程序。为了使用DLL,您需要包含相应的头文件,该头文件在DLL中声明内容,以便您的程序被编译。当您的可执行程序调用函数并请求资源时,DLL文件在运行时自动加载(由系统)。


库文件(也称为静态库,通常带有.lib扩展名)是一个二进制文件,它包含函数和变量,如DLL,但在编译时解析,意味着它们需要在链接时提供。


动态和静态库通常与头文件一起提供(但没有源文件,其中包含实现)提供商允许你使用他/她的功能/服务,但不允许你访问实现。


这就是你问的问题吗?


Lini有总结了DLL的一般含义。同一术语也用于Windows和OS / 2使用的特定形式的动态链接库。你是否知道你是指一般的术语还是特定的微软语境?


@lini


.h& b之间是否存在差异.HPP?

What is the relation/difference between a header file, dll and library?

解决方案

A header file contains declaration of something (constants, classes, ...), usually ends with a .h or hpp extension.

A DLL (dynamically linked library) is a binary file (with .dll, .ocx, .a, ... extentions), containing functions, resources, ... and can be linked to your program at run-time. In order to use a DLL you need to include the corresponding header file, which declares things in the DLL, so that your program gets compiled. The DLL file is automatically loaded (by system) at run-time when your executable program invokes functions and asks for resources.

A library file (also called static library, with .lib extension usually) is a binary file which alsocontains functions and variables like DLL, but resolved at compile-time, meaning they need to be provided at link-time.

Dynamic and static libraries are often provided together with header file (but no source file, which contains the implementation) when the provider lets you use his/her functions/services but doesnt give you access to the implementation.

Is that what you ask?


Lini has summarized the generic meaning of "DLL". The same term is also used for the specific form of dynamic-link-library used by Windows and OS/2. Do you know whether you''re referring to term generically or specifically in a Microsoft context?


@lini
Is there a difference between .h & .hpp?


这篇关于头文件,DLL和库之间的关系/区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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