#define PERL_NO_GET_CONTEXT
#include "XSUB.h"
-#include "Win32iop.h"
#include <fcntl.h>
#ifndef __GNUC__
/* assert.h conflicts with #define of assert in perl.h */
#if !defined __BORLANDC__ && !defined __MINGW32__ /* compiler intolerance */
extern int sys_nerr;
#endif
- DWORD source = 0;
if (e < 0 || e > sys_nerr) {
dTHX;
if (e < 0)
e = GetLastError();
- if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, &source, e, 0,
- w32_strerror_buffer,
- sizeof(w32_strerror_buffer), NULL) == 0)
+ if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
+ |FORMAT_MESSAGE_IGNORE_INSERTS, NULL, e, 0,
+ w32_strerror_buffer, sizeof(w32_strerror_buffer),
+ NULL) == 0)
+ {
strcpy(w32_strerror_buffer, "Unknown Error");
-
+ }
return w32_strerror_buffer;
}
+#undef strerror
return strerror(e);
+#define strerror win32_strerror
}
DllExport void
END_EXTERN_C
#undef alarm
-#define alarm win32_alarm
+#define alarm win32_alarm
+#undef strerror
+#define strerror win32_strerror
/*
* the following six(6) is #define in stdio.h
#define ferror(f) win32_ferror(f)
#define errno (*win32_errno())
#define environ (*win32_environ())
-#define strerror win32_strerror
/*
* redirect to our own version
#define free win32_free
#endif
+/* XXX Why are APIs like sleep(), times() etc. inside a block
+ * XXX guarded by "#ifndef WIN32IO_IS_STDIO"?
+ */
+
#define pipe(fd) win32_pipe((fd), 512, O_BINARY)
#define pause() win32_sleep((32767L << 16) + 32767)
#define sleep win32_sleep