[linux-audio-dev] Channels and best practice

Luis Garrido luisgarrido at users.sourceforge.net
Sun Nov 20 03:05:40 UTC 2005


> Out of curiosity, how expensive is this runtime architechture check?
>

I don't think runtime detection is necessary if you compile both
library and app for the specific arch. A few ifdef's take care of the
selection at compile time.

If you want to provide a multiarch binary, I don't know how he does
it, but you probably only have to check once when the library is first
loaded. You link your app against stub functions and then the
detection procedure can point the stubs to the right set of functions
(via, i.e., function pointers) and from there on no further check is
needed, unless you want to provide support for hot swappable cpu's ;)

The penalty in this case is an extra level of indirection (a few stack
instructions a jump and a ret) for each call. Well worth the pain,
IMO.

Luis




More information about the Linux-audio-dev mailing list