做一个C LIB&QUOT的一部分;民营" [英] Make part of a C lib "private"

查看:140
本文介绍了做一个C LIB&QUOT的一部分;民营"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个共享库,并自code是很大的,我决定把它在很多头文件和源文件拆分,如同任何正常的程序:)。

I'm developing a shared library, and since the code is big, I've decided to split it in many headers and source files, like any normal program :).

问题是,大多数这些头供内部使用,即我不希望他们是从我的库外部访问。所以我想将它们都移动到一个大的源文件,并只提供什么将是可见标题。

The problem is that most of these headers are for internal use, i.e. I don't want them to be accessible from outside of my library. So I'm thinking to move them all to a big source file and only provide headers for what is going to be visible.

这是一个好主意,这样做吗?我应该担心的知名度?

It's a good idea do that? Should I worry on visibility?

感谢

推荐答案

而不是合并头,只是让他们沿着你的源文件,也不要发布他们作为开发包的一部分。作为这样的一个例子,Linux内核有很多头文件在源代码树,但只有特定的头被暴露的应用程序(在包含结构)。

Instead of merging the headers, just keep them alongside your source files and don't "publish" them as a part of your development package. As an example of this, the linux kernel has many headers in the source tree, but only certain headers are exposed to applications (in the include structure).

这篇关于做一个C LIB&QUOT的一部分;民营"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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