Index: src/OFObject.m ================================================================== --- src/OFObject.m +++ src/OFObject.m @@ -38,11 +38,13 @@ #import "OFOutOfMemoryException.h" #import "OFOutOfRangeException.h" #import "macros.h" -#if defined(OF_OBJFW_RUNTIME) +#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME) +# import +#elif defined(OF_OBJFW_RUNTIME) # import #elif defined(OF_OLD_GNU_RUNTIME) # import #endif @@ -95,10 +97,19 @@ #endif #ifdef NEED_OBJC_PROPERTIES_INIT extern BOOL objc_properties_init(); #endif + +#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME) +static void +uncaught_exception_handler(id exception) +{ + fprintf(stderr, "Unhandled exception:\n%s\n", + [[exception description] UTF8String]); +} +#endif static void enumeration_mutation_handler(id object) { @throw [OFEnumerationMutationException @@ -176,10 +187,14 @@ fputs("Runtime error: objc_properties_init() failed!\n", stderr); abort(); } #endif + +#if defined(OF_APPLE_RUNTIME) || defined(OF_GNU_RUNTIME) + objc_setUncaughtExceptionHandler(uncaught_exception_handler); +#endif #ifdef HAVE_OBJC_ENUMERATIONMUTATION objc_setEnumerationMutationHandler(enumeration_mutation_handler); #endif