I am developing a reasonably complex iOS Application. To rationalise development, I have begin developing each module as a standalone project, which are then composed together in the top-level Application project, resulting in a tree of dependencies.
I have taken this approach successfully before, but this time around have a shared dependency (C) which causes a problem:
A
/|\
/ | \
B C D
/ \ \
C E C
Where A is the top-level Application project, and C is a 'Core Library' of functions. This core library is a dependency of A itself, as well as modules B and D. The resulting multiple complilation causes duplicate symbols in the build folder and failed linking.
Now, I can be pragmatic and just remove the reference from A, as this will be compiled into the build folder by B anyway, and if D wasn't involved, this would just work. But how do I go about resolving the duplication of C dependency from B and D? The B and D projects still need a reference to C when I compile them standalone, but there is a clash when compiled twice in the context of A.
I can imagine some convoluted solution using objcopy and giving them unique prefixes, but this would be somewhat inefficient as it's the same code. I could live with this, but is there a better way? Perhaps some compiler or linker flag to reuse an existing symbol in the build folder if one exists, instead of compiling again?
Thanks for any advice.