I’m working on two projects right now that have static library products, to be given to other developers to use in their projects: Audiobus and The Amazing Audio Engine. In both cases, I’m making quite heavy use of my circular buffer code, TPCircularBuffer, which would result in duplicate symbol errors if the static library were linked with another project that used it.
In case the solution was useful to others, here’s how I worked around it: Use the preprocessor to rename the symbols automatically during the build phase.
This is done by adding a series of
-DOldSymbol=NewSymbol flags to the ‘Other C Flags’ build setting – like
-DTPCircularBuffer=ABCircularBuffer, for instance.
No more symbol conflicts.