Go to the first, previous, next, last section, table of contents.


Preprocessor defines

libFoundation defines some preprocessor values so you can check for them if you want to conditionally pass some code to the compiler. The following macros are defined in Foundation/NSObject.h:

#define LIB_FOUNDATION_LIBRARY 1
    
#define LIB_FOUNDATION_MAJOR_VERSION 0
#define LIB_FOUNDATION_MINOR_VERSION 9
#define LIB_FOUNDATION_SUBMINOR_VERSION 0

If you want to include a portion of code that is specific to libFoundation you should put it inside an #ifdef preprocessor command:

#ifdef LIB_FOUNDATION_LIBRARY
...
#endif

This way you the code inside #ifdef is compiled only in the presence of libFoundation and will not affect other libraries.

Another macro which is defined only when the Boehm's garbage collector is used (See section Boehm's garbage collector) is LIB_FOUNDATION_BOEHM_GC. You can use it to check in your code whether the code is compiled with support for Boehm's garbage collector or not.


Go to the first, previous, next, last section, table of contents.