I am creating one application,In that i am adding one third party library.And i am created one static library.So now i want to include my library to that third party library.If i compile that third party library before adding into my application, it will create only single .a file for both or i have to include my library .a file along with third party in .a file in another sample application.And also if it will create single .a file what are the .h file i have to include only third party library .h files or my library .h files also.
-
When we add my library as the time of compilation of third party library.It will create only one .a file or not.And when i add that third party library may i need to only this compiled library .a file or my library .a file also. – venkat Oct 26 '13 at 05:28
2 Answers
Static libraries are not embedded into one another, if this is what you are asking.
A static library is just a collection of object files, each corresponding to a compilation unit (e.g., your .m files).
In practice, you can disassemble two static libraries to extract all the component object files and then reassemble those in a new static library, but this is not what the compiler does normally.
So, say you have a static library lib1.a that depends on a second static library lib2.a; you create an executable by linking both libraries with your main
function. Unless you manually "merge" the two libraries, each time you want to use lib1.a, you will also need to link lib2.a.
This can be checked really easily in Xcode.
As to header files, you need to include the header files for both libraries, as well.
If you want more information about merging two static library in order to create a new static library that includes the object files of both, check this or this.
When you link one static library to another, you only need to link the resulting combined static library with your application. You will need to include the headers that define public interface for your library, and those for the third party library in your application. Any frameworks used by either your library or the third party must be linked with the application.

- 7,964
- 2
- 36
- 41