Reputation: 8757
Is there any way to determine whether the Accelerate.framework is available at runtime from straight C or C++ files?
The examples I've found for conditional coding all seem to require Objective-C introspection (e.g., respondsToSelector
) and/or Objective-C apis (e.g., UIDevice's systemVersion
member)
Upvotes: 4
Views: 988
Reputation: 34945
The usual trick for this is that you weak link against the framework and then check a function pointer exported by that framework for the actual availability. If the framework failed to link because it is not available then the function will be NULL
.
So for Accelerate.framework
you would do something like this:
#include <Accelerate/Accelerate.h>
if (cblas_sdsdot) {
NSLog(@"Yay we got Accelerate.framework");
} else {
NSLog(@"Oh no, no Accelerate.framework");
}
This is described in TN2064 - Ensuring Binary Backwards Compatibility
Upvotes: 4