I am going to detail out a common hypothetical problem.
Problem:
I am provided with a static library say libX.a
and the header files a.h
and b.h
. The header files a.h
and b.h
contain the APIs exported by the library. a.h
includes a1.h
and b.h
includes b1.h
. But a1.h
and b1.h
are not shipped by the owner of the library because a1.h
and b1.h
contain the data structures which are used privately by the library and the owner does not want to expose these data structures.
I have to write an application invoking the APIs exported by the library. So I have to include a.h
and b.h
which contains the declaration for the APIs.
Ok, fine. I write my application and include the header files a.h
and b.h
and invoke the APIs. But I will get a compiler error, because the compiler cannot find a1.h
and b1.h
which are internally included by a.h
and b.h
.
Questions:
Is there a solution to this problem? If yes, seeking earnestly to know the solution :)
Is it necessary that the library owner expose all the private header files he internally uses in his library?