      ts = gmtime(timer);
      if (ts == NULL)
 diff --git a/e_os.h b/e_os.h
-index 514de967a9..49b68d10a3 100644
+index 9e2f14072f..70ef508971 100644
 --- a/e_os.h
 +++ b/e_os.h
 @@ -139,7 +139,7 @@ static __inline unsigned int _strlen31(const char *str)

diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index a7294d2ad1..24c887f8d3 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -1361,7 +1361,7 @@ my %targets = (
         # prefer [non-debug] openssl.exe to be free from Micorosoft RTL
         # redistributable.
         bin_cflags       => add(picker(debug   => "/MDd",

 #     undef stdin
 #     undef stdout
 #     undef stderr
@@ -147,6 +147,21 @@ FILE *__iob_func();
 #     define stdin  (&__iob_func()[0])
 #     define stdout (&__iob_func()[1])
 #     define stderr (&__iob_func()[2])
+#    else
+#     undef stdin
+#     undef stdout
+#     undef stderr
+         /*
+          * pre-1300 has __p__iob(), but it's available only in msvcrt.lib,
+          * or in other words with /MD. Declaring implicit import, i.e. with
+          * _imp_ prefix, works correctly with all compiler options, but
+          * without /MD results in LINK warning LNK4049: 'locally defined
+          * symbol "__iob" imported'.
+          */
+extern FILE *_imp___iob;
+#     define stdin  (&_imp___iob[0])
+#     define stdout (&_imp___iob[1])
+#     define stderr (&_imp___iob[2])
 #    endif
 #   endif
 #  endif
diff --git a/engines/e_capi.c b/engines/e_capi.c
index 6f223a6922..045d1368fd 100644
--- a/engines/e_capi.c
