I know how to perform this for C++/CLI and .NET in general but, C++ doesn't have Attributes. The scenario is this:
我知道如何为C ++ / CLI和.NET执行此操作,但C ++没有属性。场景是这样的:
We want to provide some methods in the binary but we don't want all of our customers to use them. If a customer needs it, we can either tell him what the signature is or, send him another non-binary file.
我们想在二进制文件中提供一些方法,但我们不希望所有客户都使用它们。如果客户需要它,我们可以告诉他签名是什么,或者给他发送另一个非二进制文件。
1 个解决方案
#1
I don't think you can control that. Since you have to publish the header files for the library, then you will expose the entire interface, even if not through intellisense.
我认为你无法控制它。由于您必须发布库的头文件,因此您将公开整个界面,即使不是通过intellisense。
However, you should think that there are other tools doing the same thing, used by many developers (e.g. Visual Assist).
但是,您应该认为还有其他工具在做同样的事情,许多开发人员都在使用它们(例如Visual Assist)。
If you need to hide some implementation details, a better solution is to apply pimpl idiom and provide in header files the interface classes, with the "public", usable methods.
如果您需要隐藏一些实现细节,更好的解决方案是应用pimpl习惯用法并在头文件中提供具有“公共”可用方法的接口类。
The implementation classes will be included only from the cpp files containing that are compiled, and only forward declared in the public header files.
实现类将仅包含在包含已编译的cpp文件中,并且仅在公共头文件中声明转发。
#1
I don't think you can control that. Since you have to publish the header files for the library, then you will expose the entire interface, even if not through intellisense.
我认为你无法控制它。由于您必须发布库的头文件,因此您将公开整个界面,即使不是通过intellisense。
However, you should think that there are other tools doing the same thing, used by many developers (e.g. Visual Assist).
但是,您应该认为还有其他工具在做同样的事情,许多开发人员都在使用它们(例如Visual Assist)。
If you need to hide some implementation details, a better solution is to apply pimpl idiom and provide in header files the interface classes, with the "public", usable methods.
如果您需要隐藏一些实现细节,更好的解决方案是应用pimpl习惯用法并在头文件中提供具有“公共”可用方法的接口类。
The implementation classes will be included only from the cpp files containing that are compiled, and only forward declared in the public header files.
实现类将仅包含在包含已编译的cpp文件中,并且仅在公共头文件中声明转发。