2

I have a bunch of code I am using in multiple projects. Right now, I am doing it by copy-and-paste, which is less than ideal. As I understand it, to have multiple projects refer to the same source code, I have at least two options:

1) Create a static library and include it in multiple projects

2) Create a project with the shared source code, and import that into all of the other projects.

What are the advantages and disadvantages of these approaches? When might I prefer one over the other?

1
  • Either way you should include a project with the shared file in your other projects. This ensures that the latest version is used with every build. Commented Dec 31, 2010 at 19:21

2 Answers 2

1

You can include project with static library, which will use all advantages from static library and included project :) It works well, cannot say anything about significant disadvantages of such approach.

Sign up to request clarification or add additional context in comments.

2 Comments

The only disadvantage would be that there is an extra library to load at runtime (not much of a disadvantage).
Static libraries are compiled into application, so there would be no any step to load it.
0

The only disadvantage of including a static external librairy to your project would be the size of it; if you are using a library that will be "universal" (working on the simulator + the device), you'll have to target i386 and arm (today armv7). So you will inflate your project with "dead code" that can't be used on for your mobile solution.

If you include a project with share source code, you'll be able to compile just what you need for you mobile device, but everybody can see your code ...

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.