diff src/sys.c @ 56:43d1102a367e

core: disable buffering on MinGW
author David Demelier <markand@malikania.fr>
date Tue, 21 Jan 2020 12:26:49 +0100
parents f581a78c8e78
children
line wrap: on
line diff
--- a/src/sys.c	Mon Jan 20 13:38:05 2020 +0100
+++ b/src/sys.c	Tue Jan 21 12:26:49 2020 +0100
@@ -17,6 +17,8 @@
  */
 
 #include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
 
 #include <SDL.h>
 #include <SDL_image.h>
@@ -97,6 +99,11 @@
 bool
 sys_init(void)
 {
+#if defined(__MINGW64__)
+	/* On MinGW buffering leads to painful debugging. */
+	setvbuf(stdout, NULL, _IONBF, 0);
+#endif
+
 	if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0)
 		return error_sdl();
 	if (IMG_Init(IMG_INIT_PNG) != IMG_INIT_PNG)