Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -404,11 +404,11 @@ case "$host_os" in darwin*) AC_SUBST(LDFLAGS_REEXPORT, ["-Wl,-reexport-lobjfw"]) AS_IF([test x"$objc_runtime" = x"Apple runtime"], [ AC_SUBST(REEXPORT_LIBOBJC, ["-Wl,-reexport-lobjc"]) - LDFLAGS="$LDFLAGS -Wl,-U,_CFRetain" + LDFLAGS="$LDFLAGS -Wl,-U,_NSFoundationVersionNumber" ]) AS_IF([test x"$objc_runtime" = x"ObjFW runtime"], [ AS_IF([test x"$exception_type" = x"DWARF"], [ LDFLAGS="$LDFLAGS -Wl,-U,___gxx_personality_v0" Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -58,11 +58,11 @@ #elif defined(OF_HAVE_THREADS) # import "threading.h" #endif #ifdef OF_APPLE_RUNTIME -extern void* CFRetain(void*) __attribute__((__weak__)); +extern double *NSFoundationVersionNumber __attribute__((__weak__)); #endif #if defined(OF_HAVE_FORWARDING_TARGET_FOR_SELECTOR) extern id of_forward(id, SEL, ...); extern struct stret of_forward_stret(id, SEL, ...); @@ -218,18 +218,19 @@ objc_setUncaughtExceptionHandler(uncaughtExceptionHandler); #endif #if defined(OF_APPLE_RUNTIME) /* - * If the CFRetain symbol is defined, we are linked against - * CoreFoundation. Since CoreFoundation sets its own forward handler - * on load, we should not set ours, as this will break CoreFoundation. + * If the NSFoundationVersionNumber symbol is defined, we are linked + * against Foundation. Since CoreFoundation sets its own forward + * handler on load, we should not set ours, as this will break + * 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 (&CFRetain == NULL) + if (&NSFoundationVersionNumber == NULL) objc_setForwardHandler((void*)&of_forward, (void*)&of_forward_stret); #else objc_setForwardHandler((IMP)&of_forward, (IMP)&of_forward_stret); #endif