@@ -32,18 +32,17 @@ #define USE_INLINE_STDARG #include #include -struct ObjFWBase; - #if defined(OF_AMIGAOS_M68K) # include #elif defined(OF_MORPHOS) # include #endif +extern struct Library *ObjFWRTBase; #ifdef HAVE_SJLJ_EXCEPTIONS extern int _Unwind_SjLj_RaiseException(void *); #else extern int _Unwind_RaiseException(void *); #endif @@ -273,10 +272,13 @@ void *__objc_class_name_OFMutableUTF8String; void *__objc_class_name_OFRangeCharacterSet; void *__objc_class_name_OFSelectKernelEventObserver; void *__objc_class_name_OFUTF8String; +#ifndef OF_AMIGA_LIB +struct Library *ObjFWBase; + static void error(const char *string, ULONG arg) { struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); @@ -368,11 +370,11 @@ if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB, OBJFW_LIB_MINOR)) == NULL) error("Failed to open " OBJFW_AMIGA_LIB " version %lu!", OBJFW_LIB_MINOR); - if (!OFInit(1, &libC)) + if (!OFInit(1, &libC, ObjFWRTBase)) error("Failed to initialize " OBJFW_AMIGA_LIB "!", 0); initialized = true; } @@ -380,14 +382,14 @@ dtor(void) { CloseLibrary(ObjFWBase); } -#if defined(OF_AMIGAOS_M68K) +# if defined(OF_AMIGAOS_M68K) ADD2INIT(ctor, -2); ADD2EXIT(dtor, -2); -#elif defined(OF_MORPHOS) +# elif defined(OF_MORPHOS) CONSTRUCTOR_P(ObjFW, 5000) { ctor(); return 0; @@ -395,10 +397,11 @@ DESTRUCTOR_P(ObjFW, 5000) { dtor(); } +# endif #endif extern void OFPBKDF2Wrapper(const OFPBKDF2Parameters *parameters); extern void OFScryptWrapper(const OFScryptParameters *parameters);