Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -21,10 +21,14 @@ #include #include #include + +#ifdef OF_APPLE_RUNTIME +# include +#endif #import "OFObject.h" #import "OFArray.h" #import "OFLocalization.h" #import "OFTimer.h" @@ -57,14 +61,10 @@ # import "atomic.h" #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif -#ifdef OF_APPLE_RUNTIME -extern double NSFoundationVersionNumber; -#endif - #if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR) extern id of_forward(id, SEL, ...); extern struct stret of_forward_stret(id, SEL, ...); #else # define of_forward of_method_not_found @@ -226,11 +226,11 @@ * Foundation. * * Unfortunately, there is no way to check if a forward handler has * already been set, so this is the best we can do. */ - if (&NSFoundationVersionNumber == NULL) + if (dlsym(RTLD_DEFAULT, "NSFoundationVersionNumber") == NULL) objc_setForwardHandler((void *)&of_forward, (void *)&of_forward_stret); #else objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret); #endif