@@ -20,19 +20,22 @@ #import "ObjFW.h" #import "amiga-library.h" #import "macros.h" #include +#define USE_INLINE_STDARG +#include struct ObjFWBase; #import "inline.h" #include #include #include #include +#include #if defined(OF_AMIGAOS_M68K) # include # define SYM(name) __asm__("_" name) #elif defined(OF_MORPHOS) @@ -364,11 +367,11 @@ if ((ObjFWBase = OpenLibrary(OBJFW_AMIGA_LIB, OBJFW_LIB_MINOR)) == NULL) error("Failed to open " OBJFW_AMIGA_LIB " version %lu!", OBJFW_LIB_MINOR); if (!glue_of_init(1, &libc, __sF)) - error("Failed to initialize " OBJFWRT_AMIGA_LIB "!", 0); + error("Failed to initialize " OBJFW_AMIGA_LIB "!", 0); initialized = true; } static void __attribute__((__used__)) @@ -440,18 +443,29 @@ of_log(OFConstantString *format, ...) { va_list arguments; va_start(arguments, format); - glue_of_logv(format, arguments); + of_logv(format, arguments); va_end(arguments); } void of_logv(OFConstantString *format, va_list arguments) { +#ifdef OF_MORPHOS + /* The generated code does not work with va_list, so do it manually. */ + __asm__ __volatile__ ( + "mr %%r12, %0" + :: "r"(ObjFWBase) + ); + + ((void (*)(OFConstantString *, va_list))*(void **)(ObjFWBase - 76))( + format, arguments); +#else glue_of_logv(format, arguments); +#endif } int of_application_main(int *argc, char ***argv, id delegate)