I want some code tobe compiled under 10.6 and below but not 10.7 and above.
For example:
#ifdef current version is MAC_OS_X_VERSION_10_6 or below
// do this
elif current version is MAC_OS_X_VERSION_10_7 or above
//do that
#endif
Can someone help me ge proper macros for it? I looked into AvailabilityMacros.h but was not able to figure out proper ifdef.
I have a dynamic library, and it cannot be loaded under 10.7 and above but loads properly under 10.6. This is due to private symbol _CGContextAppendPath. I want to keep it using under 10.6 and below but avoid its use in 10.7 and below. This is because _CGContextAppendPath symbol is not present on 10.7 and above.
I used,
SInt32 version = 0;
Gestalt( gestaltSystemVersion, &version );
bool lionabove = ( version >= 0x1070 );
did not work.
For Objective C, the go-to route would be to check the availability of specific APIs via e.g.
[object respondsToSelector:].For the C library you are using, weak-link to
CoreGraphics.framework(so the loading doesn’t fail when some functions aren’t present) and check for availability of the function in question via&_CGContextAppendPath != NULL.Details in http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html#//apple_ref/doc/uid/10000163i-CH1-107837 and http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/cross_development/Using/using.html#//apple_ref/doc/uid/20002000-1114537-BABHHJBC.