Index: src/runtime/misc.m ================================================================== --- src/runtime/misc.m +++ src/runtime/misc.m @@ -21,10 +21,14 @@ #include #include #include "ObjFWRT.h" #include "private.h" + +#ifdef OF_WINDOWS +# include +#endif #ifdef OF_AMIGAOS # define USE_INLINE_STDARG # include # include @@ -53,26 +57,38 @@ } void objc_error(const char *title, const char *format, ...) { -#ifdef OF_AMIGAOS +#if defined(OF_WINDOWS) || defined(OF_AMIGAOS) # define BUF_LEN 512 char message[BUF_LEN]; int status; va_list args; - struct Library *IntuitionBase; -# ifdef OF_AMIGAOS4 - struct IntuitionIFace *IIntuition; -# endif - struct EasyStruct easy; va_start(args, format); status = vsnprintf(message, BUF_LEN, format, args); if (status <= 0 || status >= BUF_LEN) message[0] = '\0'; va_end(args); +# undef BUF_LEN +#endif + +#if defined(OF_WINDOWS) + fprintf(stderr, "[%s] %s\n", title, message); + fflush(stderr); + + MessageBoxA(NULL, message, title, + MB_OK | MB_SYSTEMMODAL | MB_ICONERROR); + + exit(EXIT_FAILURE); +#elif defined(OF_AMIGAOS) + struct Library *IntuitionBase; +# ifdef OF_AMIGAOS4 + struct IntuitionIFace *IIntuition; +# endif + struct EasyStruct easy; # ifndef OF_AMIGAOS4 kprintf("[%s] %s\n", title, message); # endif @@ -98,11 +114,10 @@ # endif CloseLibrary(IntuitionBase); exit(EXIT_FAILURE); -# undef BUF_LEN #else va_list args; va_start(args, format);