@@ -25,10 +25,12 @@ #endif #include #include #include + +#import "platform.h" #ifndef __has_feature # define __has_feature(x) 0 #endif @@ -197,22 +199,20 @@ struct objc_protocol_list *_Nullable next; long count; Protocol *__unsafe_unretained _Nonnull list[1]; }; -#ifdef __cplusplus +#if 1 /* !defined(OF_MORPHOS) || defined(OF_COMPILING_OBJFW_RT) */ +# ifdef __cplusplus extern "C" { -#endif +# endif extern SEL _Nonnull sel_registerName(const char *_Nonnull); extern const char *_Nonnull sel_getName(SEL _Nonnull); extern bool sel_isEqual(SEL _Nonnull, SEL _Nonnull); extern Class _Nonnull objc_allocateClassPair(Class _Nullable, const char *_Nonnull, size_t); extern void objc_registerClassPair(Class _Nonnull); -extern id _Nullable objc_lookUpClass(const char *_Nonnull); -extern id _Nullable objc_getClass(const char *_Nonnull); -extern id _Nonnull objc_getRequiredClass(const char *_Nonnull); extern unsigned int objc_getClassList(Class _Nonnull *_Nullable, unsigned int); extern Class _Nonnull *_Nonnull objc_copyClassList(unsigned int *_Nullable); extern bool class_isMetaClass(Class _Nullable); extern const char *_Nullable class_getName(Class _Nullable); extern Class _Nullable class_getSuperclass(Class _Nullable); @@ -238,14 +238,37 @@ extern void objc_exit(void); extern _Nullable objc_uncaught_exception_handler objc_setUncaughtExceptionHandler( objc_uncaught_exception_handler _Nullable); extern void objc_setForwardHandler(IMP _Nullable, IMP _Nullable); +extern void objc_setEnumerationMutationHandler( + objc_enumeration_mutation_handler _Nullable); extern void objc_zero_weak_references(id _Nonnull); +# ifdef __cplusplus +} +# endif +#else +# define BOOL EXEC_BOOL +# include +# undef BOOL +# ifdef __cplusplus +extern "C" { +# endif +extern struct Library *ObjFWRTBase; +# ifdef __cplusplus +} +# endif +# include "ppcinline.h" +#endif +#ifdef __cplusplus +extern "C" { +#endif /* * Used by the compiler, but can also be called manually. + * + * They need to be in the glue code for the MorphOS library. * * These declarations are also required to prevent Clang's implicit * declarations which include __declspec(dllimport) on Windows. */ struct objc_abi_module; @@ -254,10 +277,13 @@ extern IMP _Nonnull objc_msg_lookup_stret(id _Nullable, SEL _Nonnull); extern IMP _Nonnull objc_msg_lookup_super(struct objc_super *_Nonnull, SEL _Nonnull); extern IMP _Nonnull objc_msg_lookup_super_stret(struct objc_super *_Nonnull, SEL _Nonnull); +extern id _Nullable objc_lookUpClass(const char *_Nonnull); +extern id _Nullable objc_getClass(const char *_Nonnull); +extern id _Nonnull objc_getRequiredClass(const char *_Nonnull); extern void objc_exception_throw(id _Nullable); extern int objc_sync_enter(id _Nullable); extern int objc_sync_exit(id _Nullable); extern id _Nullable objc_getProperty(id _Nonnull, SEL _Nonnull, ptrdiff_t, BOOL); @@ -266,12 +292,10 @@ extern void objc_getPropertyStruct(void *_Nonnull, const void *_Nonnull, ptrdiff_t, BOOL, BOOL); extern void objc_setPropertyStruct(void *_Nonnull, const void *_Nonnull, ptrdiff_t, BOOL, BOOL); extern void objc_enumerationMutation(id _Nonnull); -extern void objc_setEnumerationMutationHandler( - objc_enumeration_mutation_handler _Nullable); #ifdef __cplusplus } #endif #endif