From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David PONCE Newsgroups: gmane.emacs.devel Subject: Re: Issues with Windows gcc -mno-cygwin (Mingw) Date: Wed, 19 Mar 2003 08:39:40 +0100 (CET) Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <32603294.1048059580273.JavaMail.www@wwinf0502> Reply-To: david.ponce@wanadoo.fr NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: main.gmane.org 1048059667 18555 80.91.224.249 (19 Mar 2003 07:41:07 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 19 Mar 2003 07:41:07 +0000 (UTC) Cc: emacs-devel Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Wed Mar 19 08:41:05 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18vYC9-0004p8-00 for ; Wed, 19 Mar 2003 08:41:05 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18vYCo-0007JN-00 for ; Wed, 19 Mar 2003 08:41:46 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vYBE-0004z7-00 for emacs-devel@quimby.gnus.org; Wed, 19 Mar 2003 02:40:08 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18vYAu-0004oi-00 for emacs-devel@gnu.org; Wed, 19 Mar 2003 02:39:48 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18vYAo-0004Qx-00 for emacs-devel@gnu.org; Wed, 19 Mar 2003 02:39:45 -0500 Original-Received: from smtp2.wanadoo.fr ([193.252.22.26] helo=mwinf0503.wanadoo.fr) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18vYAn-0004Jp-00; Wed, 19 Mar 2003 02:39:41 -0500 Original-Received: from wwinf0502 (wwinf0502 [172.22.136.29]) by mwinf0503.wanadoo.fr (Postfix) with ESMTP id 482FF68009FF; Wed, 19 Mar 2003 08:39:40 +0100 (CET) Original-To: jasonr@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12456 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12456 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. >=20 >=20 > 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 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/emacs/emacs/src/sysdep.c,v retrieving revision 1.248 diff -c -r1.248 sysdep.c *** src/sysdep.c=094 Feb 2003 14:03:13 -0000=091.248 --- src/sysdep.c=0919 Mar 2003 07:29:14 -0000 *************** *** 3231,3236 **** --- 3231,3248 ---- #endif /* not WINDOWSNT */ #endif /* ! HAVE_STRERROR */ =0C + /* + 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 >=3D 2 && __MINGW32_MINOR_VERSION > 2 + #include /* _O_BINARY */ + int _CRT_fmode =3D _O_BINARY; + #endif +=20 int emacs_open (path, oflag, mode) const char *path;