Your problem is, you are declaring everything in the header file. That means even if the symbols are not exported, when you import the header file into another file, these symbols are re-created in the project where you imported the header and thus they are of course available within this project.
I'm trying to explain this to you by a simpler sample. Assume you have two files, MyLib.h and MyLib.c.
MyLib.h:
int add(int a, int b);
MyLib.c:
int add(int a, int b) { return a + b };
If you now give add
a hidden
visibility and compile everything to a library (MyLib
), the library will have no symbol for add
(as it is hidden). As a result, if you include MyLib.h
into another file, make a call to the add
function there and finally link this file against MyLib
, you will get a linker error, since the linker will complain that it cannot find an implementation for add
(it only has a declaration from the H file).
However, if you pack the function into the header itself, so MyLib.h is:
int add(int a, int b) { return a + b };
and you give add
a hidden
visibility, the library will also have no symbol for add
, but when you include the header into another file, this header will create a symbol for add
in exactly the file that imported it and thus of course you will not get a linker error and be able to call add
.
Importing a H file just means copying the whole content of the H file to the location where the import instruction has been found. Now think about it: If you copy the whole content of the H file in your question to the top of the file where you are including it, of course all symbols declared there are visible and usable in the current project. Why wouldn't they be visible or useable? They are not in the library, yes, but they are in the header and thus do get compiled when your other project is compiled.
Symbols that are supposed to not be visible outside your current project ("hidden" symbols) should never appear in any public header file of your framework. Why would you announce the existence of symbols in a header files that cannot be used anyway? Actually, in most cases not exposing the symbols in the header file is already enough to prevent people from using them. The reason for not exporting them either is only that if a symbol exists, it can be used, even if it is not exposed by any header file (therefor you just need to write your own header file or declaring it as external
symbol directly in your code). So making symbols hidden is just a safeguard to make sure that it cannot be used under any circumstances.