为什么开源库中包含库的包含文件夹 [英] Why there is include folder with libraries in open source libraries

查看:109
本文介绍了为什么开源库中包含库的包含文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我将ICU二进制文件用作外部二进制文件.我具有lib/dll和包含一些".h"文件的include文件夹.
为什么在开放源代码库中包含包含库的文件夹?该dll曾经包含在您的项目中,并且已经过编译,因此编译器无需一遍又一遍地执行此操作. .h文件包含库dll中使用的某些数据类型. dll可能期望某种结构类型作为某些功能的输入.头文件包含这些特定类型,因此您无需弄清楚它们并重新定义自己.
以某种粗略的方式,您可以将头文件视为编译器的某种剧透警报,告知编译器代码文件中应包含的内容.它还为您提供有关定义的类型和功能的信息.

附言并非开放源代码的库也可以包含头文件.它们不包含实际的实现(或至少不应该包含),但是确实使该库可用.

祝您好运!


所有库中都应该有一个include文件夹(或至少一个include文件),因为库客户端程序(即您的应用程序)至少需要原型.库导出函数的功能.


为什么开源库中包含带有库的include文件夹?
如果我理解您的问题,它将询问为什么我们的文件夹中没有几个* .h文件.

这是因为,此文件夹将在某个时刻具有开放源代码正在引用/使用的所有库.将其分开保存在文件夹中,也可以轻松地从维护点查找外部依赖库.单独的文件夹表示该文件夹为引用的库文件夹.


Hi,
I am using ICU binary as an external binary.I have lib/dll and an include folder having some ".h" files.
Why there is include folder with libraries in open source libraries?

解决方案

Not totally clear what you mean, but my guess is that you mix-up some things. The dll is used to include in your project and is already compiled so the compiler won''t need to do this over and over again. The .h files contain certain datatypes used in the library dll. The dll might expect some kind of struct type as input for some functions. The header files contain those specific types so you don''t need to figure them out and redefine yourself.
In some crude way you can look at header files as some kind of spoiler alert for the compiler that tells it what to expect in the code files. It also gives you information about defined types and function.

Ps. also libraries that aren''t open source can include the header files. They don''t contain the actual implementation (or at least shouldn''t) but do make the library usable.

Good luck!


There should be an include folder (or, at least, an include file) in all libraries, since the library client program (that is your application) needs at least the prototypes of the library exported functions.


Why there is include folder with libraries in open source libraries?
If I understand your question, it asks why do we have few *.h files in a folder.

This is because, this folder will have all the libraries that the open source is referring/using at some point. Keeping it separate in a folder makes it easy to find the external dependent libraries from maintenance point too. Separate folder signifies the folder as referenced library folder.


这篇关于为什么开源库中包含库的包含文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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