Index: src/amiga-library.m ================================================================== --- src/amiga-library.m +++ src/amiga-library.m @@ -45,12 +45,10 @@ # define OF_M68K_REG(reg) __asm__(#reg) #else # define OF_M68K_REG(reg) #endif -struct Library *DOSBase; - /* This always needs to be the first thing in the file. */ int _start() { return -1; @@ -397,13 +395,10 @@ return false; if (base->initialized) return true; - if ((DOSBase = OpenLibrary("dos.library", 0)) == NULL) - return false; - memcpy(&libc, libc_, sizeof(libc)); __sF = sF; #ifdef OF_AMIGAOS_M68K if ((size_t)_EH_FRAME_BEGINS__ != (size_t)_EH_FRAME_OBJECTS__) Index: src/libbases.m ================================================================== --- src/libbases.m +++ src/libbases.m @@ -21,10 +21,13 @@ #import "OFInitializationFailedException.h" #import "macros.h" +#ifdef OF_COMPILING_AMIGA_LIBRARY +struct Library *DOSBase; +#endif #ifdef OF_AMIGAOS4 extern struct Library *DOSBase; extern struct DOSIFace *IDOS; #endif struct Library *LocaleBase; @@ -32,14 +35,16 @@ struct LocaleIFace *ILocale; #endif OF_CONSTRUCTOR() { -#ifdef OF_AMIGAOS4 +#if defined(OF_COMPILING_AMIGA_LIBRARY) || defined(OF_AMIGAOS4) if ((DOSBase = OpenLibrary("dos.library", 36)) == NULL) @throw [OFInitializationFailedException exception]; +#endif +#ifdef OF_AMIGAOS4 if ((IDOS = (struct DOSIFace *) GetInterface(DOSBase, "main", 1, NULL)) == NULL) @throw [OFInitializationFailedException exception]; #endif @@ -62,12 +67,14 @@ if (LocaleBase != NULL) CloseLibrary(LocaleBase); #ifdef OF_AMIGAOS4 - if (DOSBase != NULL) - CloseLibrary(DOSBase); - if (IDOS != NULL) DropInterface((struct Interface *)IDOS); #endif + +#if defined(OF_COMPILING_AMIGA_LIBRARY) || defined(OF_AMIGAOS4) + if (DOSBase != NULL) + CloseLibrary(DOSBase); +#endif }