Index: src/linklib/linklib.m ================================================================== --- src/linklib/linklib.m +++ src/linklib/linklib.m @@ -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) Index: src/morphos-clib.h ================================================================== --- src/morphos-clib.h +++ src/morphos-clib.h @@ -6,11 +6,11 @@ uint32_t *glue_of_hash_seed_ref(void); OFStdIOStream **glue_of_stdin_ref(void); OFStdIOStream **glue_of_stdout_ref(void); OFStdIOStream **glue_of_stderr_ref(void); void glue_of_logv(OFConstantString *format, va_list arguments); -int glue_of_application_main(int *argc, char ***argv, id delegate); +int glue_of_application_main(int *argc, char ***argv, id delegate); const char *glue_of_http_request_method_to_string(of_http_request_method_t method); of_http_request_method_t glue_of_http_request_method_from_string(OFString *string); OFString *glue_of_http_status_code_to_string(short code); size_t glue_of_sizeof_type_encoding(const char *type); size_t glue_of_alignof_type_encoding(const char *type); Index: src/runtime/linklib/linklib.m ================================================================== --- src/runtime/linklib/linklib.m +++ src/runtime/linklib/linklib.m @@ -21,10 +21,11 @@ #import "amiga-library.h" #import "macros.h" #import "private.h" #include +#define USE_INLINE_STDARG #include struct ObjFWRTBase; #import "inline.h"