Index: src/runtime/linklib/linklib.m ================================================================== --- src/runtime/linklib/linklib.m +++ src/runtime/linklib/linklib.m @@ -20,10 +20,11 @@ #import "ObjFWRT.h" #import "private.h" #import "macros.h" #include +#include struct ObjFWRTBase; #import "inline.h" @@ -73,10 +74,32 @@ static int * get_errno(void) { return &errno; } + +static void +error(const char *string, ULONG arg) +{ + struct Library *IntuitionBase = OpenLibrary("intuition.library", 0); + + if (IntuitionBase != NULL) { + struct EasyStruct easy = { + .es_StructSize = sizeof(easy), + .es_Flags = 0, + .es_Title = (UBYTE *)NULL, + .es_TextFormat = (UBYTE *)string, + (UBYTE *)"OK" + }; + + EasyRequest(NULL, &easy, NULL, arg); + + CloseLibrary(IntuitionBase); + } + + exit(EXIT_FAILURE); +} static void __attribute__((__used__)) ctor(void) { static bool initialized = false; @@ -123,19 +146,16 @@ if (initialized) return; if ((ObjFWRTBase = OpenLibrary(OBJFWRT_AMIGA_LIB, - OBJFWRT_LIB_MINOR)) == NULL) { - fputs("Failed to open " OBJFWRT_AMIGA_LIB "!\n", stderr); - abort(); - } - - if (!glue_objc_init(1, &libc, stdout, stderr)) { - fputs("Failed to initialize " OBJFWRT_AMIGA_LIB "!\n", stderr); - abort(); - } + OBJFWRT_LIB_MINOR)) == NULL) + error("Failed to open " OBJFWRT_AMIGA_LIB " version %lu!", + OBJFWRT_LIB_MINOR); + + if (!glue_objc_init(1, &libc, stdout, stderr)) + error("Failed to initialize " OBJFWRT_AMIGA_LIB "!", 0); initialized = true; } static void __attribute__((__used__))