3

I need to make a iOS static library (A) that include another library (B), but I don't have source code for library B. I only have a .a file and headers. Is it possible?

I created project with 2 targets, 1 - test target, 2 - target for library. How to add library B to target 2 correctly? I need only one library in result.

0

2 Answers 2

2

Static libraries don't link and are simply a collection of object files, however you can package the object files from both libraries into a single .a file.

You could write an Post Build Script on your static library Xcode target that combines both libraries by unpacking them and then recreating the new library, however getting the right paths (i.e. using the correct Xcode environment variables) could be tricky.

It's something like:

ar x libyours.a
ar x libtheirs.a
rm -f libyours.a
ar c libyours.a *.o
Sign up to request clarification or add additional context in comments.

Comments

0

Add static library B into Porject A as usual. Then in your static library target add library B in to 'Link Binary with Libraries' should work.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.