[Stk] iOS static library
Richard Dobson
richarddobson at blueyonder.co.uk
Tue Mar 4 00:47:20 PST 2014
On 04/03/2014 03:08, Ariel Elkin wrote:
> Hi all,
..
> 1) Although the Xcode project builds a static library, it's currently
> only compiling Stk.cpp, and the user is advised to manually add the
> files they require (you could say it's more of a pseudo dynamic
> library…) It was either that or have the static library compile every
> single source file. But that didn't seem right as most use cases of
> the STK don't require compiling 100 source files… But I think that's
> the approach you've taken for the STK's build system on other
> platforms. So would you suggest having a static library for iOS that
> compiles every source file or one that requires the user to cherry
> pick the files required?
>
Unless gcc/Xcode is really dumb (which I don't think it is), it will not
link the whole of a static library with an app regardless - only the
functions the app actually uses, i.e. the linker does the cherry-picking
itself. The linker/compiler also does a standard "dead code elimination"
step when compiling/optimising, so even the code you have written in the
app but which never gets called is also excluded. So I just built the
whole of the stk as a static library (minus the redundant bits such as
direct audio i/o). So - my stk static library runs out at some 9MB, but
my test iOS app, which uses only a small part of it, is under 500K.
Richard Dobson
More information about the Stk
mailing list