io.h is required for open and _wopen, and fcntl.h is required for
the O_CREAT flag. On mingw, fcntl.h is included by os_support.h (and
the mingw fcntl.h includes io.h), but include it explicitly here
since this implementation requires it.
Also move the #undef open up. open must not be defined to ff_win32_open
while including the headers that declare the open function. On mingw,
this happened in os_support.h before open was redirected.
Signed-off-by: Martin Storsjö <martin@martin.st>
#include "os_support.h"
#if defined(_WIN32) && !defined(__MINGW32CE__)
+#undef open
+#include <fcntl.h>
+#include <io.h>
#include <windows.h>
-#undef open
int ff_win32_open(const char *filename_utf8, int oflag, int pmode)
{
int fd;