Here is something that might help you. Essentially what your code does is trying to forward varargs (...) into a varargs function (...). This is generally not supported in standard, but works on some architectures which use stack for passing arguments. I dug into AROS sources and have two solutions which should work on any architecture. Both involve variadic argument macros, which might not be available on old compilers.
#include <proto/exec.h>
#include <libraries/mui.h>
#include <proto/muimaster.h>
#include <stdio.h>
struct Library *MUIMasterBase = NULL;
#define SOLUTION2
#ifdef ORIGINAL
#define VARARGS68K
static void VARARGS68K ask(Object *app, const char *fmt, ...)
{
va_list va;
va_start(va, fmt);
MUI_Request(app, NULL, 0, "Requester", "*Ok", fmt,
(APTR)va->overflow_arg_area);
va_end(va);
}
#endif
#ifdef SOLUTION1
#define ask(app, fmt, ...) \
({\
MUI_Request(app, NULL, 0, "S1", "*Ok", fmt, __VA_ARGS__); \
})
#endif
#ifdef SOLUTION2
#define ask(app, fmt, ...) \
({ \
IPTR __args[] = { AROS_PP_VARIADIC_CAST2IPTR(__VA_ARGS__) }; \
MUI_RequestA((app), NULL, 0, "S2", "*Ok", fmt, __args); \
})
#endif
int main(void)
{
MUIMasterBase = OpenLibrary((STRPTR)MUIMASTER_NAME, 0);
if (MUIMasterBase == NULL) {
printf("No MUI\n");
return 10;
}
Object *app = ApplicationObject, End;
ask(app, "6 * 7 = %d", 42);
MUI_DisposeObject(app);
CloseLibrary(MUIMasterBase);
return 0;
}