Make .incbin and object writing work ok under MinGW.
authorggn <ggn.dbug@gmail.com>
Fri, 14 Apr 2017 21:47:23 +0000 (00:47 +0300)
committerShamus Hammons <jlhamm@acm.org>
Sat, 15 Apr 2017 01:04:24 +0000 (20:04 -0500)
rmac.h

diff --git a/rmac.h b/rmac.h
index f81b9a94290a11daf4f652d97ac05a3df413b510..ee252efd5473fbb4664b2752b0ce157cdd60ab71 100644 (file)
--- a/rmac.h
+++ b/rmac.h
 #else
 
        #ifdef __GCCUNIX__
-       #ifdef __MINGW32__
-       #define off64_t long
-       #define off_t long
-       #endif
 
        #include <sys/fcntl.h>
        #include <unistd.h>
        #define _OPEN_FLAGS     O_TRUNC|O_CREAT|O_RDWR
        #define _OPEN_INC       O_RDONLY
        #define _PERM_MODE      S_IRUSR|S_IWUSR
+
+       #ifdef __MINGW32__
+       #define off64_t long
+       #define off_t long
+       #undef _OPEN_FLAGS
+       #undef _OPEN_INC
+       #define _OPEN_FLAGS     _O_TRUNC|_O_CREAT|_O_BINARY|_O_RDWR
+       #define _OPEN_INC       O_RDONLY|_O_BINARY
+       #endif
+
        // WARNING WARNING WARNING
        #define DO_PRAGMA(x) _Pragma (#x)
        #define WARNING(desc) DO_PRAGMA(message (#desc))