I'm working on a C++ library project. I need to include a platform specific header to get access to some #defines
. The catch is, I only want the platform's header visible within my my header. For those including my header, I don't want them to see the additional symbols.
I thought about using a C++ namespace to contain/control the symbol visibility, but it does not work (confer, #define statements within a namespace). And as far as I know, options like --exclude-libs,all
only applies to library symbols at link time, and not header symbols.
I also thought about using the symbols I need from the platform header, and then undefining all the symbols it includes. But I don't know how to wildcard #undef platform_header.h/*
.
There's a similar question at Including a header file into a header file without exposing it's content to the includer. He's doing it to limit IDE auto-completion, which is producing different answers than I need because of different requirements.
How can I limit the visibility of an included platform header to just my library header?