From d31773e0f438f3cd8a65717e50560bcf4f582487 Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Thu, 31 Dec 2015 12:16:02 +0000 Subject: [PATCH] For discussion! Enable compilation using Visual C++ 2002 & 2003 This bizarre patch results in a full test-suite pass for Visual Studio .NET 2002 & 2003. Without it, the following code segfaults (resulting in 6 failing tests): ```ocaml #load "unix.cma";; let (ifd, _) = Unix.pipe ();; Unix.in_channel_of_descr ifd;; ``` --- otherlibs/win32unix/channels.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/otherlibs/win32unix/channels.c b/otherlibs/win32unix/channels.c index a2d241614..911db6528 100644 --- a/otherlibs/win32unix/channels.c +++ b/otherlibs/win32unix/channels.c @@ -46,6 +46,9 @@ CAMLprim value win_inchannel_of_filedescr(value handle) CAMLlocal1(vchan); struct channel * chan; +#if defined(_MSC_VER) && _MSC_VER < 1400 + fflush(stdin); +#endif chan = caml_open_descriptor_in(win_CRT_fd_of_filedescr(handle)); if (Descr_kind_val(handle) == KIND_SOCKET) chan->flags |= CHANNEL_FLAG_FROM_SOCKET;