From 2e82d4aad469b99b28613efe82c2b83a73c30fe1 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 27 May 2019 10:45:55 -0400 Subject: [PATCH] Wrote uiprivReportError() on Windows. Now to fix the... lots of compiler errors :| --- windows/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/windows/main.cpp b/windows/main.cpp index dbb69264..4b0525be 100644 --- a/windows/main.cpp +++ b/windows/main.cpp @@ -146,3 +146,19 @@ void uiQueueMain(void (*f)(void *data), void *data) // TODO handle error } } + +void uiprivReportError(const char *prefix, const char *msg, const char *suffix, bool internal) +{ + // Print to both stderr and the debugger; the former handles the case of a console and the latter handles the case of not. + // TODO find a reliable way to check if stderr is connected (the mere presence of a console window is not one) + fprintf(stderr, "*** %s: %s. %s\n", prefix, msg, suffix); + // Use OutputDebugStringA() directly because these *are* runtime MBCS strings. + OutputDebugStringA(prefix); + OutputDebugStringA(": "); + OutputDebugStringA(msg); + OutputDebugStringA(". "); + OutputDebugStringA(suffix); + OutputDebugStringA("\n"); + DebugBreak(); + abort(); // we shouldn't reach here +}