[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Issues with Windows gcc -mno-cygwin (Mingw)
From: |
David PONCE |
Subject: |
Re: Issues with Windows gcc -mno-cygwin (Mingw) |
Date: |
Wed, 19 Mar 2003 08:39:40 +0100 (CET) |
Hi Jason,
>>- Problem with _fmode (global MSC variable set to O_BINARY as the
>> default file mode). For a simple patch see below. Strictly
>> speaking I think the real problem is that this is not handled
>> without the _fmode hack. The code should just use its own global
>> variable (or even more simply just add O_BINARY everywhere) instead
>> of using this brittle compiler/runtime dependent solution.
>
>
> I don't understand what problem this is fixing. Can you explain some
> more?
I use latest versions of native mingw tools (not through cygwin):
- gcc 3.2.2 (mingw special 20030208-1)
- binutils 2.13.90-20030111-1
- mingw-runtime 2.4
- w32api 2.2
I also encountered that problem, with latest versions of the
mingw-runtime (2.3, 2.4).
Since these versions, the default runtime _fmode is text mode.
Because of that, I noticed that Emacs incorrectly reads some data,
and I got runtime errors, particularly in the function
"get_doc_string" in doc.c.
I followed the examples given by the mingw team, and did the
following patch, that I put in sysdep.c. Since that, my Emacs works
like a charm!
Notice that I had to do the same thing with the latest pretest
21.2.95, to fix similar problems.
Hope it will help.
David
Index: src/sysdep.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/sysdep.c,v
retrieving revision 1.248
diff -c -r1.248 sysdep.c
*** src/sysdep.c 4 Feb 2003 14:03:13 -0000 1.248
--- src/sysdep.c 19 Mar 2003 07:29:14 -0000
***************
*** 3231,3236 ****
--- 3231,3248 ----
#endif /* not WINDOWSNT */
#endif /* ! HAVE_STRERROR */
+ /*
+ Since version 2.3 mingw-runtime default IO mode is textmode.
+ That causes invalid data to be read by Emacs, which in turn causes
+ various execution failures. Changing default runtime IO mode to
+ binary, when mingw-runtime is > 2.2, avoid that.
+ */
+ #if defined(WINDOWSNT) && defined (__MINGW32__) \
+ && __MINGW32_MAJOR_VERSION >= 2 && __MINGW32_MINOR_VERSION > 2
+ #include <fcntl.h> /* _O_BINARY */
+ int _CRT_fmode = _O_BINARY;
+ #endif
+
int
emacs_open (path, oflag, mode)
const char *path;